< All Advanced Penetration Testing Notes

saintpwn | Advanced Penetration Testing | Module 2 - Programming

By: pha3t0n | Related Course: Advanced Penetration Testing | Published: August 2, 2017 | Modified: August 2, 2017
Join Cybrary

NotepadBash scripting

#!/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 $1.$x | grep ”64 bytes” | cut -d  ” ” -f 4 | sed ’s/.$//’

done

 


NotepadC Script

#include <stdio.h>

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

{

if (argc < 2)

{

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

return -1;

}

else 

{

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

return 0;

}

}


NotepadPython scripting

#!/usr/bin/python

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)):

Indent

print ”Port”, port, ”is closed”

else: 

Indent

print ”Port”, port, ”is open”

 


< 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