-
Notifications
You must be signed in to change notification settings - Fork 5
/
decoder.py
36 lines (29 loc) · 811 Bytes
/
decoder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python3
# Small tool to decode ASP.NET __VIEWSTATE variable
#
# VIEWSTATE module from https://github.com/yuvadm/viewstate.git
#
# spinfoo
import viewstate
import exceptions
import sys
import colors as c
#
# @TODO: Pass URL, parse content and print __VIEWSTATE decoded!
#
## Valid format: "/wEPDwU[a-zA-Z0-9=]+"
c.print_red("** ASP.NET __VIEWSTATE decoder **\n")
if len(sys.argv) != 2:
print("Usage: decoder.py \"<__VIEWSTATE ASP.NET string>\"")
print("Example: decoder.py \"/wEPDwUKMTU5MTA2ODYwOWRkoCvvBWgUOH7PD446qvEOF6GTCq0=\"")
sys.exit()
vst= sys.argv[1]
c.print_blue("[*] Decoding __VIEWSTATE:")
print(vst)
try:
vs= viewstate.ViewState(vst)
c.print_green(str(vs.decode()))
except exceptions.ViewStateException as e:
print (e)
except IndexError as e:
print (e)