After reading some information on the Internet, I found that it cannot be used. So I checked it online and changed the last line to use it.
'''
Python XSS payload encoder
Author: BGS (rstcenter.com)
Contributor cmiN (rstcenter.com)
Date: 13 August 2011
Version: Python 2.7
'''
#! /Usr/bin/env python
Import time
Import sys
Import urllib2
Import base64
Def main ():
Try:
If sys. argv [1] = "help ":
Print '[-]' + time. ctime ()
Print ''' [-] Instructions:
Encoder. py <encoding type> "<string>"
Available encodings: ascii b64 hex url
[-] Exiting...
'''
Elif sys. argv [1] = "b64 ":
B64_encode ()
Elif sys. argv [1] = "ascii ":
Ascii_encode ()
Elif sys. argv [1] = "hex ":
Hex_encode ()
Elif sys. argv [1] = "url ":
Url_encode ()
Else:
Sys. exit (1)
Except t Exception, e:
Print 'Type "encoder. py help" for instructions! '
Sys. exit (1)
Def b64_encode ():
Payload = sys. argv [2]
Encoded = base64.standard _ b64encode (payload)
Print '################## B64 String ################## #####'
Print''
Print 'string: '+ encoded
Print''
Print "#####################> EOF <############# ############"
Def ascii_encode ():
Payload = sys. argv [2]
String =''
For w in payload:
String + = str (ord (w) + ","
Print '################## ASCII String ################## ###'
Print''
Print 'string. fromCharCode ('+ string. strip (",") + ')'
Print''
Print "#####################> EOF <############# ############"
Def hex_encode ():
Payload = sys. argv [2]
Encoded = payload. encode ('hex ')
Print '################# HEX String www.2cto.com ################# ######'
Print''
Print 'string: '+ encoded
Print''
Print "#####################> EOF <############# ############"
Def url_encode ():
Payload = sys. argv [2]
Encoded = urllib2.quote (payload. encode ("utf8 "))
Print '################## URL String ################## #####'
Print''
Print 'string: '+ encoded
Print''
Print "#####################> EOF <############# ############"
If _ name _ = '_ main __':
Main ()
This article comes from the dedicated waiting blog