-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBetterTutorial.user.js
More file actions
171 lines (165 loc) · 6.71 KB
/
BetterTutorial.user.js
File metadata and controls
171 lines (165 loc) · 6.71 KB
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
// ==UserScript==
// @name Better Tutorial by Logfro
// @namespace https://logfro.de/
// @version 0.01
// @description Skips Tutorial and/or does it for you
// @author Logfro
// @match https://legacy.hackerexperience.com/*
// @updateURL https://gitcdn.xyz/repo/Logfro/BetterHex/master/BetterTutorial.meta.js
// @downloadURL https://gitcdn.xyz/repo/Logfro/BetterHex/master/BetterTutorial.user.js
// @grant none
// ==/UserScript==
(function () {
setTimeout(function () {
const URL = window.location.href;
if (URL.indexOf("https://legacy.hackerexperience.com/software?action=install&id=") > -1) return false;
if (URL.indexOf("https://legacy.hackerexperience.com/internet?action=hack&method=bf") > -1) return false;
if (URL.indexOf("https://legacy.hackerexperience.com/processes?pid=") > -1) return false;
if (URL.indexOf("https://legacy.hackerexperience.com/internet?view=software&cmd=up&id=") > -1) return false;
if (URL.indexOf("https://legacy.hackerexperience.com/internet?view=software&cmd=install&id=") > -1) return false;
var times = localStorage.getItem("times");
var step = localStorage.getItem("step");
var pressed = localStorage.getItem("pressed");
if (times == null) {
localStorage.setItem("times", "0");
localStorage.setItem("step", "0");
times = 0;
}
if (times == 3) {
localStorage.setItem("step", ++step);
hackTutorial();
} else {
switch (URL) {
case "https://legacy.hackerexperience.com/welcome.php":
window.location = "https://legacy.hackerexperience.com/university?opt=certification";
break;
case "https://legacy.hackerexperience.com/university?opt=certification":
if (document.getElementById("learn") != null) {
document.getElementById("learn").click();
}
$(".buycert")[times].click();
localStorage.setItem("times", ++times);
if (times == 3) {
window.location = window.location.href;
}
break;
default:
break;
}
if (URL.indexOf("https://legacy.hackerexperience.com/university?opt=certification&learn=") > -1) {
skipBtn();
}
}
function skipBtn() {
$(".btn-success")[0].click();
}
function hackTutorial() {
switch (step) {
case 1:
window.location = "https://legacy.hackerexperience.com/software";
break;
case 2:
$(".tip-top")[2].click();
break;
case 3:
window.location = $("td")[1].children[0].href;
break;
case 4:
window.location = "https://legacy.hackerexperience.com/missions";
break;
case 5:
$(".black")[0].click();
break;
case 6:
window.location = "https://legacy.hackerexperience.com/internet?action=hack&method=bf";
break;
case 7:
$("#loginform").submit();
break;
case 8:
clearLogs();
break;
case 9:
window.location = "https://legacy.hackerexperience.com/internet?view=software";
break;
case 10:
window.location = "https://legacy.hackerexperience.com/internet?view=logs";
break;
case 11:
window.location = "https://legacy.hackerexperience.com/internet?view=logout";
break;
case 12:
window.location = "https://legacy.hackerexperience.com/missions";
break;
case 13:
$(".black")[0].click();
break;
case 14:
window.location = "https://legacy.hackerexperience.com/internet?action=hack&method=bf";
break;
case 15:
$("#loginform").submit();
break;
case 16:
clearLogs();
break;
case 17:
window.location = "https://legacy.hackerexperience.com/software";
break;
case 18:
window.location = "https://legacy.hackerexperience.com/internet?view=software&cmd=up&id=" + $("tr")[2].id;
break;
case 19:
$(".tip-top")[3].click();
break;
case 20:
window.location = "https://legacy.hackerexperience.com/missions";
break;
case 21:
$(".mission-complete")[0].click();
setTimeout(function () {
$("#modal-submit").click();
}, 1500);
break;
case 22:
reset();
break;
}
}
function clearLogs() {
var elm = document.getElementsByName("log")[0];
var x = elm.value;
var ownIP = document.getElementsByClassName("header-ip-show")[0].innerHTML;
var button = $("input.btn-inverse").get(1);
if (x.search(ownIP) == -1) {
alert("Your IP (" + ownIP + ") isnt present in this log!");
return false;
}
x = x.replaceAll(ownIP, "");
elm.value = x;
button.click();
}
function getIP() {
var log = document.getElementsByName("log")[0];
var logCopy = log.value;
var ips = [];
while (logCopy.indexOf("[") > 0) {
var indexStart = logCopy.indexOf("[");
var stopIndex = logCopy.indexOf("]");
var s = logCopy.substring(indexStart + 1, stopIndex);
var l = ips.length;
if (ips.indexOf(s) == -1) {
ips[l] = s;
}
logCopy = logCopy.substring(stopIndex + 1);
}
console.log("done");
console.log(ips);
return ips[0];
}
function reset(){
localStorage.removeItem("times");
localStorage.removeItem("step");
}
}, 2000);
})();