Skip to content

Commit

Permalink
created simple vuln scanner to learn python
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Oct 27, 2017
1 parent e743250 commit 3653a3e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions simple_vulln_scanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import socket
import os
import sys

def retBanner(ip, port):
try:
socket.setdefaulttimeout(2)
s = socket.socket()
s.connect((ip, port))
banner = s.recv(1024)
return banner
except:
return
def checkVulns(banner, filename):
f = open(filename, 'r')
for line in f.readlines():
if line.strip('\n') in banner:
print '[+] Server is vulnerable: ' + banner.strip('\n')
def main():
if len(sys.argv) == 2:
filename = sys.argv[1]
if not os.path.isfile(filename):
print '[-] ' + filename + ' does not exist.'
exit(0)
if not os.access(filename, os.R_OK):
print '[-] ' + filename + ' access denied.'
exit(0)
else:
print '[-] Usage: ' + str(sys.argv[0]) + ' <vuln filename>'
exit(0)
portList = [21, 22, 25, 80, 110, 443]
for x in range(147, 150):
ip = '192.168.95.' + str(x)
for port in portList:
banner = retBanner(ip, port)
if banner:
print '[+] ' + ip + ': ' + banner
checkVulns(banner, filename)
if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions vuln_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test

0 comments on commit 3653a3e

Please sign in to comment.