Skip to content

Instantly share code, notes, and snippets.

@imran-parray
Created May 23, 2020 05:40
Show Gist options
  • Save imran-parray/708aff5000db8a8642ba213ffef00e6a to your computer and use it in GitHub Desktop.
Save imran-parray/708aff5000db8a8642ba213ffef00e6a to your computer and use it in GitHub Desktop.
import re
import sys
urls=[]
try:
file_name=sys.argv[1]
replacement=sys.argv[2]
except:
print("[!] Enter urls file name")
else:
try:
with open(file_name,'r') as fh:
for line in fh:
urls.append(line)
except:
print("File not Found")
else:
regex2=r'=(.*)$'
final=[]
for line in urls:
params=[]
if '?' in line:
params.append(line.split('?')[0])
x=line.split('?')[1]
z=x.split('&')
for a in z:
params.append(re.sub(regex2, '='+replacement+'&', a))
final.append('?'.join(params).replace('&?','&').rstrip('\n&'))
for a in final:
if 'http' in a:
print(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment