-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathurls.py
More file actions
executable file
·31 lines (25 loc) · 849 Bytes
/
urls.py
File metadata and controls
executable file
·31 lines (25 loc) · 849 Bytes
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
#!/usr/bin/env python3
import sys
def main(argv):
if len(argv) != 3:
print('Usage: ' + argv[0] + ' <ammo file> <urls.txt file>')
return 1
with open(argv[1], 'rb') as ammofile:
ammo = ammofile.read().decode('utf8')
with open(argv[2], 'a') as urls:
prevline = None
post = None
for line in ammo.split('\n'):
if line.startswith('GET'):
urls.write(
'http://localhost' + line.split()[1] + '\n')
if line.startswith('POST'):
post = line.split()[1]
if prevline == '\r' and post:
urls.write(
'http://localhost' + post + ' POST ' + line + '\n')
post = None
prevline = line
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))