< All Advanced Penetration Testing Notes

Pawan Singh | Advanced Penetration Testing | Module 2 - Programming

By: Pawan Kumar Singh | Related Course: Advanced Penetration Testing | Published: October 13, 2017 | Modified: October 13, 2017
Join Cybrary

NotepadChapert IX

Chapter IX

#!/bin/bash

if [ ”$1” ==””]

then

echo ~Usage: ./ping.sh [network]~

echo”Example: ./ping.sh 192.168.1”

else

for x in seq 1 254 ; do

ping -c 1 ping $1.$x | grep ”64 bytes” cut -d ” ” -f 4 | sed ’s/.$//’

done

fi

save

#./ping.sh 192.168.1

output

 

 

 


NotepadChapert VIII

Bash scripting

ping sweep

ping www.google.com

nano/vi editor

nano ping.sh —write script

#!/bin/bash

echo ~Usage: ./ping.sh [network]~

echo”Example: ./ping.sh 192.168.1”

save.

#ping.sh  – not work

echo $PATH

./ping.sh permission deny

ls -l ping.sh

chmod 700 pingh.sh

#ping.sh

#!/bin/bash

if [ ”$1”==””]

then

echo ~Usage: ./ping.sh [network]~

echo”Example: ./ping.sh 192.168.1”

fi

save

ping.sh

nothing found in screen

 

 

 

 


NotepadChapert X

Python Script

#which python > path

nano python.py

#!/usr/bin/python ( port scanner)

import socket

ip = raw_input(”Enter the IP address: ”)

port = input (”Enter the port number: ”)

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

if sock.connect_ex((ip,port)):

  print ”Port”,port, ”is closed”

else:

  print  ”Port”, port, ”is open”

 

 

Save

# chmod +x python.ph

#./python.ph

Enter the Ip address : 192.168.1.76

Enter the port number : 80

 

#./python.ph

enter the Ip 192.168.1.75

Enter port : 81

Port 81 is closed

 

 

 

 

 

 

 


NotepadChapter VII

Chapter VII- Programming

 

 


NotepadChaptorXI

C program

#include <stdio.h>

int main(int argc, char ”argv[])

{

   if  (argc < 2)

   {

       printf(’%s\n”, ”Pass your name as an argument”);

 return -1;

   }

else

{

      printf(”Hello %s\n”, argv[1]);

    return 0;

}

}

Save.

#nano cprogram.c

gcc cprogram.c -o cprogram

chmod +x cproram

./cprogram

pass your name as an argument pawan

Hellow Pawan.

 

 

 


< All Advanced Penetration Testing Notes
Join Cybrary

Our Revolution

We believe Cyber Security training should accessible for everyone, everywhere. Everyone deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is the world's largest community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel