Skip to content

Instantly share code, notes, and snippets.

@eybisi
Created August 30, 2018 15:34
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 eybisi/86de68a6e3c4df2d2224dba6b85141f7 to your computer and use it in GitHub Desktop.
Save eybisi/86de68a6e3c4df2d2224dba6b85141f7 to your computer and use it in GitHub Desktop.
anubis c2 dec
import base64
import sys
t = []
for i in range(256):
t.append(i)
bArr = bytearray(sys.argv[1].encode("utf-8"))
i2 = 0
def swap(i,i2,arr):
i3 = arr[i]
arr[i] = arr[i2]
arr[i2] = i3
for i in range(256):
i2 = (((i2 + t[i])+ bArr[i% len(bArr)]) +256)% 256
swap(i,i2,t)
b = base64.b64decode(sys.argv[2]).decode()
print(b)
t2 = []
for i in range(int(256/2)):
t2.append(i)
barr3 = []
for i in range(0,len(b),2):
barr3.append( (int(b[i],16) << 4) + int(b[i+1],16))
b = 0
c = 0
barr4 = []
for i in range(len(barr3)):
b = (b+1)%256
c = (c+t[b])%256
swap(b,c,t)
barr4.append(t[(t[b]+t[c])%256] ^ barr3[i])
for i in barr4:
print(chr(i),end="")
# sample https://twitter.com/Jacob17918360/status/1033177684707356672
# Example usage : python dec.py flash1 MzA5MGMwOGFjNjI5MzkwY2MwODk2ZjMwOTk3OTNjMDIxNzM0YzcyOA==
# http://supersheet.ga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment