-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstripper.html
139 lines (117 loc) · 4.45 KB
/
stripper.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Stripper</title>
<style>
body {
background-color: black;
color: #00FF00;
font-family: 'Courier New', Courier, monospace;
}
h1, p, label {
color: #00FF00;
}
a {
color: #FFFF00;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
textarea, input {
background-color: black;
color: #00FF00;
border: 1px solid #00FF00;
padding: 10px 10px;
}
button {
background-color: black;
color: #00FF00;
border: 1px solid #00FF00;
padding: 10px 10px;
font-weight: bold;
font-size: 26px;
}
button:hover {
background-color: black;
color: yellow;
cursor: pointer;
}
.yellow-button {
background-color: black;
color: yellow;
border: 2px solid #FFFF00;
padding: 1px 2px;
font-weight: bold;
text-align: center;
display: inline-block;
text-decoration: none;
}
.yellow-button:hover {
background-color: yellow;
color: black;
border: 1px solid #FFFF00;
cursor: pointer;
padding: 3px 4px;
}
</style>
<script>
// Configuration: Define the values to strip (keys)
const config = ["cookie", "x-csrf-token", "x-xsrf-token"];
// Function to strip data based on the configuration and generate a .txt file
function stripData() {
// Get the text input from the user
const inputText = document.getElementById("inputField").value;
// Get the filename from the user
const fileName = document.getElementById("filename").value || 'stripped_data'; // Default filename if empty
// Initialize an empty object to store the stripped values
let strippedData = {};
// Loop through each key in the config and search for the pattern in the text
config.forEach(key => {
const regex = new RegExp(`${key}:\\s*([^\\s]+)`, 'i'); // Regex to find "key: value"
const match = inputText.match(regex);
if (match) {
let extractedValue = match[1].trim();
// Remove trailing ' symbol if present
if (extractedValue.endsWith("'")) {
extractedValue = extractedValue.slice(0, -1);
}
strippedData[key.toUpperCase()] = extractedValue; // Save with uppercase key
}
});
// If no data was found, alert the user and stop
if (Object.keys(strippedData).length === 0) {
alert("No matching values found.");
return;
}
// Prepare the content for the .txt file
let content = "";
for (const [key, value] of Object.entries(strippedData)) {
content += `${key}=${value}\n`;
}
// Create a Blob with the content and trigger the download
const blob = new Blob([content], { type: "text/plain" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = fileName + ".txt"; // Use the filename input or default to 'stripped_data.txt'
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
</head>
<body>
<h1>Obieraczka do requestów</h1>
<p>Wklej surowy request cURL by wyekstraktować z niego ciastka i tokeny</p>
<textarea id="inputField" rows="10" cols="50" placeholder="Wklej surowy cURL request tutaj..."></textarea>
<br><br>
<label for="filename">Jak nazwać nowy plik? </label>
<input type="text" id="filename" placeholder="Nazwa pliku?">
<br><br>
<button onclick="stripData()">Obieraj</button>
<!-- Instruction button that stands out -->
<a href="https://github.com/serainox420/JBZD-Scripts/blob/personal/HTML/README.md" class="yellow-button" target="_blank">Instrukcja Obsługi</a>
</body>
</html>