Skip to content

Instantly share code, notes, and snippets.

@aerosayan
Forked from imran-parray/paramReplacer.py
Created June 12, 2020 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aerosayan/0ae7130743f94b795c164bd50dc693d0 to your computer and use it in GitHub Desktop.
Save aerosayan/0ae7130743f94b795c164bd50dc693d0 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