SHOW:
|
|
- or go back to the newest paste.
1 | import os | |
2 | import subprocess | |
3 | import re | |
4 | import time | |
5 | import ftplib | |
6 | RawCodesPath = [] | |
7 | class Transforkey: | |
8 | def __init__(self): | |
9 | self.Array = [1,2,3] | |
10 | self.DoArray = [1,2,3] | |
11 | self.Main_Dictionary = [] | |
12 | self.ForMice = 'Transformice.swf' | |
13 | self.ActionScript = 'source.as' | |
14 | self.UrlForMice = 'http://Transformice.com/Transformice.swf' | |
15 | self.StartTemplate = "b'var\s<q>\[public\]::\w+:<q>\[public\]flash\.utils::Timer'" | |
16 | self.EndTemplate = 'return' | |
17 | self.SplitTemplate = 'getlex <q>[public]' | |
18 | self.OneTwoOneTwoTpl = "callpropvoid <q>[public]::writeUTF, 1 params" | |
19 | self.VerKey = [] | |
20 | self.MainFile = 0 | |
21 | self.As3ToArray = [] | |
22 | self.TempBool = False | |
23 | self.NewsLines = [] | |
24 | self.Dic = [] | |
25 | self.TempDir = [] | |
26 | self.Version = [] | |
27 | self.RawCodes = [] | |
28 | self.File = None | |
29 | ||
30 | def SetUp(self, One, Two): | |
31 | print 'cat %s.bin >> %s.bin | cat %s.bin >> %s.bin'%(One, self.File, Two, self.File) | |
32 | subprocess.call('cat %s.bin >> %s.bin '%(One, self.File), shell=True) | |
33 | subprocess.call('cat %s.bin >> %s.bin'%(Two, self.File), shell=True) | |
34 | string = subprocess.call('swfdump ' + self.File + '.bin', shell=True) | |
35 | return int(string) | |
36 | def start(self): | |
37 | self.DoArray = [1,2,3] | |
38 | if os.path.exists(self.ForMice):os.remove(self.ForMice) | |
39 | self.Array = [1,2,3] | |
40 | for i in self.Array: | |
41 | if os.path.exists(str(i) + '.bin'):os.remove(str(i) + '.bin') | |
42 | print "Getting Flash..." | |
43 | subprocess.call('wget http://Transformice.com/Transformice.swf', shell=True) | |
44 | print "Done | Exporting..." | |
45 | subprocess.call('swfextract -b 1 Transformice.swf -o 1.bin | swfextract -b 2 Transformice.swf -o 2.bin | swfextract -b 3 Transformice.swf -o 3.bin', shell=True) | |
46 | for i in [1,2,3]: | |
47 | if open(str(i)+'.bin', 'rb').read(3) == "CWS": | |
48 | self.File = str(i) | |
49 | print self.File + '.bin' | |
50 | del self.Array[int(self.File)-1] | |
51 | break | |
52 | # def ReturnVar(self, list): | |
53 | # for i, j in enumerate(list): | |
54 | # if | |
55 | def Main(self): | |
56 | global RawCodesPath | |
57 | RawCodesPath = [] | |
58 | self.start() | |
59 | if self.SetUp(self.Array[0], self.Array[1]) == 1: | |
60 | self.start() | |
61 | self.SetUp(self.Array[1], self.Array[0]) | |
62 | subprocess.call('swfdump -a ' + self.File + '.bin>' + self.ActionScript, shell=True) | |
63 | openf = open(self.ActionScript, 'r') | |
64 | lines = [] | |
65 | for i in openf.readlines(): | |
66 | lines.append(i) | |
67 | for i, j in enumerate(lines): | |
68 | #if 'var <q>[public]::llIIIiIlOI:<q>[public]flash.utils::Timer' in lines[i]: print 'var <q>[public]::llIIIiIlOI:<q>[public]flash.utils::Timer' | |
69 | if re.search(b'var\s<q>\[public\]::\w+:<q>\[public\]flash\.utils::Timer', lines[i])!=None: | |
70 | if '[public]flash.events::Event' in lines[i+1]: | |
71 | NewLists = lines[i:] | |
72 | ||
73 | for i, j in enumerate(NewLists): | |
74 | if 'returnvoid' in NewLists[i]: | |
75 | NewLists = NewLists[:i] | |
76 | break | |
77 | for i in NewLists: | |
78 | if 'getlex <q>[public]' in i: | |
79 | self.Dic.append(self.TempDir) | |
80 | self.TempDir = [] | |
81 | self.TempDir.append(i) | |
82 | ||
83 | OmgZomg = False | |
84 | Smind = [] | |
85 | Key = 0 | |
86 | for i, j in enumerate(NewLists): | |
87 | if 'getproperty <q>[private]NULL' in NewLists[i]: | |
88 | for m, k in enumerate(lines): | |
89 | if 'var <q>[private]NULL::' + NewLists[i].split('::')[1].replace('\n', '') + ':<q>[public]::int' in lines[m]: | |
90 | self.Version.append(lines[m].split(' = ')[1].replace('\n', '')) | |
91 | break | |
92 | break | |
93 | rawPacketCodes = [] | |
94 | """linez = lines | |
95 | for (i, j) in enumerate(lines): | |
96 | if re.match(b'\s*sealed\sprotectedNS\(\[protected\]\w+\)\s*class\s*<q>\[public\]::\w+\s*extends\s*<q>\[public\]::\w+\{\s*', j): | |
97 | if re.match(b'.+constructor \* <q>\[public\]::\w+=\(<q>\[public\]::String\).+', lines[i+9]): | |
98 | for k in range(1, 20): | |
99 | if re.match(b'.+getproperty\s<q>\[public\]::.+\s+', lines[i+9+k])\ | |
100 | and re.match(b'.+getproperty\s<q>\[public\]::.+\s+', lines[i+9+k+2]): | |
101 | #and re.match(b'.+callpropvoid\s<q>\[public\]::writeUTF.+', lines[i+9+k+2+4]): | |
102 | C = re.match(b'.+getproperty\s<q>\[public\]::(.+)\s+', lines[i+9+k]).groups()[0] | |
103 | CC = re.match(b'.+getproperty\s<q>\[public\]::(.+)\s+', lines[i+9+k+2]).groups()[0] | |
104 | # if CC == C: | |
105 | omnom = [] | |
106 | #rawPacketCodes.append([C[:-1], CC[:-1]]) | |
107 | C = 'var <q>[public]::' + C | |
108 | CC = 'var <q>[public]::' + CC | |
109 | #rawPacketCodes.append([C[:-1], CC[:-1]]) | |
110 | for m, t in enumerate(linez): | |
111 | if C in linez[m]: | |
112 | omnom.append(linez[m].split(' = ')[1].replace('\n', '')) | |
113 | if CC in linez[m]: | |
114 | omnom.append(linez[m].split(' = ')[1].replace('\n', '')) | |
115 | RawCodesPath.append(str(' '.join(omnom))) | |
116 | for i, j in enumerate(lines): | |
117 | for m in rawPacketCodes: | |
118 | if 'var <q>[public]::' + m[0] in lines(i): | |
119 | for k in rawPacketCodes: | |
120 | if | |
121 | rawSourceData.append() | |
122 | print rawPacketCodes""" | |
123 | print RawCodesPath | |
124 | for String in self.Dic: | |
125 | OmgZomg = False | |
126 | Key = 0 | |
127 | for Result in String: | |
128 | if 'rshift' in Result: OmgZomg = True | |
129 | if 'pushbyte' in Result: | |
130 | Key+=int(Result.split('pushbyte')[1].replace(' ', '')) | |
131 | if 'pushshort' in Result and int(Result.split('pushshort')[1].replace(' ', '')) not in [6125,800,600]: | |
132 | Key+=int(Result.split('pushshort')[1].replace(' ', '')) | |
133 | if Key!=0: | |
134 | if OmgZomg: Smind.append(chr(Key>>1)) | |
135 | else:Smind.append(chr(Key)) | |
136 | self.Version.append(str(str(''.join(Smind)))) | |
137 | #Version | |
138 | return self.Version | |
139 | ||
140 | def RawCode(self): | |
141 | return self.RawCodes | |
142 | ||
143 | now_time = time.time() | |
144 | ||
145 | def UpTime(): | |
146 | File = open('/var/www/html/data.txt', 'w') | |
147 | KeyVersion = str(time.time()) + ' ' + ' '.join(Transforkey().Main()) | |
148 | print KeyVersion | |
149 | File.write(KeyVersion) | |
150 | File.close() | |
151 | #File = open('/var/www/html/pcodes.txt', 'w') | |
152 | print RawCodesPath | |
153 | #File.write(str(' | '.join( str(n) for n in RawCodesPath))) | |
154 | #File.close() | |
155 | ||
156 | def upload(ftp, file): | |
157 | ext = os.path.splitext(file)[1] | |
158 | if ext in (".txt", ".htm", ".html"): | |
159 | ftp.storlines("STOR " + file, open(file)) | |
160 | else: | |
161 | ftp.storbinary("STOR " + file, open(file, "rb"), 1024) | |
162 | ||
163 | UpTime() | |
164 | while True: | |
165 | if time.time() - now_time > 120: | |
166 | UpTime() | |
167 | now_time = time.time() |