Skip to content

Commit a887c39

Browse files
committed
updates
1 parent 60d8491 commit a887c39

File tree

9 files changed

+54
-4
lines changed

9 files changed

+54
-4
lines changed

InfoLocation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def geocode(self,latitude,longitude):
6767
print(decoded['results'][0]['address_components'][4]['long_name'].encode('utf-8'))
6868
print(decoded['results'][0]['address_components'][5]['long_name'].encode('utf-8'))
6969
print(decoded['results'][0]['address_components'][6]['long_name'].encode('utf-8'))
70+
lat_lon = decoded['results'][0]['geometry']['location']
71+
print(lat_lon['lat'].encode('utf-8'))
72+
print(lat_lon['lng'].encode('utf-8'))
7073

7174
except Exception,e:
7275
pass
@@ -106,6 +109,9 @@ def geocode2(self,address):
106109
print(decoded['results'][0]['address_components'][4]['long_name'].encode('utf-8'))
107110
print(decoded['results'][0]['address_components'][5]['long_name'].encode('utf-8'))
108111
print(decoded['results'][0]['address_components'][6]['long_name'].encode('utf-8'))
112+
lat_lon = decoded['results'][0]['geometry']['location']
113+
print(lat_lon['lat'].encode('utf-8'))
114+
print(lat_lon['lng'].encode('utf-8'))
109115

110116
except Exception,e:
111117
pass

InfoLocation.pyc

191 Bytes
Binary file not shown.

NmapScanner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def nmapScan(self, host, port):
1818
print "[*] Execuing command: %s" % self.nmsc.command_line()
1919
self.state = self.nmsc[host]['tcp'][int(port)]['state']
2020
print " [+] "+ host + " tcp/" + port + " " + self.state
21+
print self.nmsc[host].tcp(int(port))
22+
self.server = self.nmsc[host].tcp(int(port))['product']
23+
self.version = self.nmsc[host].tcp(int(port))['version']
24+
print " [+] "+ self.server + " " + self.version + " tcp/" + port
2125

2226
except Exception,e:
2327
print "Error to connect with " + host + " for port scanning"

NmapScanner.pyc

181 Bytes
Binary file not shown.

ShodanSearch.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# -*- encoding: utf-8 -*-
22
#class for search in shodan
33
import shodan
4+
import requests
45

56
class ShodanSearch:
67

78
def __init__(self):
89
#shodan key
910
self.shodanKeyString = 'v4YpsPUJ3wjDxEqywwu6aF5OZKWj8kik'
1011
self.shodanApi = shodan.Shodan(self.shodanKeyString)
12+
1113

1214
def shodanKeyInfo(self):
1315
try:
@@ -27,6 +29,42 @@ def execute(self,ip):
2729
print "SHODAN empty reply or error in the call"
2830
return "error"
2931

32+
#Obtain info IP
33+
def obtain_host_info2(self,target):
34+
35+
dnsResolve = 'https://api.shodan.io/dns/resolve?hostnames=' + str(target) + '&key=' + self.shodanKeyString
36+
37+
try:
38+
# First we need to resolve our targets domain to an IP
39+
resolved = requests.get(dnsResolve)
40+
hostIP = resolved.json()[target]
41+
42+
43+
# Then we need to do a Shodan search on that IP
44+
host = self.shodanApi.host(hostIP)
45+
print "IP: %s" % host['ip_str']
46+
print "Organization: %s" % host.get('org', 'n/a')
47+
print "Operating System: %s" % host.get('os', 'n/a')
48+
49+
50+
# Print all banners
51+
for item in host['data']:
52+
print "Port: %s" % item['port']
53+
print "Banner: %s" % item['data']
54+
55+
56+
# Print vuln information
57+
for item in host['vulns']:
58+
CVE = item.replace('!','')
59+
print 'Vulns: %s' % item
60+
exploits = api.exploits.search(CVE)
61+
for item in exploits['matches']:
62+
if item.get('cve')[0] == CVE:
63+
print item.get('description')
64+
except Exception as e:
65+
print e
66+
print 'An error occured'
67+
3068
#Obtain info IP
3169
def obtain_host_info(self,ip):
3270
try:

ShodanSearch.pyc

1.01 KB
Binary file not shown.

pentesting-tool.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ def showMenu():
191191
if option == "6":
192192
f = open('logHostInfo.txt', 'a')
193193
sys.stdout = Log(sys.stdout, f)
194-
shodanSearch.obtain_host_info(ip)
195-
shodanSearch.obtain_host_info(hostname)
194+
shodanSearch.obtain_host_info2(ip)
195+
shodanSearch.obtain_host_info2(hostname)
196196
if option == "7":
197197
f = open('logNScanningNmap.txt', 'a')
198198
sys.stdout = Log(sys.stdout, f)
@@ -288,9 +288,10 @@ def showMenu():
288288
pynexposeHttps = pynexposeHttps.NeXposeServer(serveraddr_nexpose, port_server_nexpose, user_nexpose, password_nexpose)
289289
pyconnect = 1
290290
except Exception,e:
291-
pyconnect = 0
291+
pyconnect = 0
292+
print e.message
292293
print "Error to connecting with NeXposeServer"
293-
print e
294+
294295
pass
295296

296297
try:

pynexposeHttps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def engine_listing(self):
6666
def login(self):
6767
response = self.call("Login", {'user-id' : self.username, 'password' : self.password})
6868
self.token = response.attrib['session-id']
69+
print response
6970

7071
def logout(self):
7172
response = self.call("Logout")

pynexposeHttps.pyc

7 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)