-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_gen-maxlength.sh
More file actions
executable file
·29 lines (25 loc) · 895 Bytes
/
_gen-maxlength.sh
File metadata and controls
executable file
·29 lines (25 loc) · 895 Bytes
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
#!/bin/bash
# cookie="60gpD=xxx; PHPSESSID=xxx"
[[ -z $cookie ]] && exit 1
urlencode() {
python3 -c 'import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]));' "$1"
}
jq -r '.[]|.' < postalcodes.json | \
grep -F ^ | \
sed -r -e 's/\{([0-9])\}/{\1,\1}/g' -e 's/\^|\$/\//g' -e 's/\\([()])/\1/g' | \
sort -u | \
while read -r f; do
g=$(urlencode "$f");
echo "$f";
curl -s 'https://www.dcode.fr/api/' \
-H 'User-Agent: Mozilla/5.0' \
-H 'Accept: application/json, text/javascript, */*;' \
-H 'Referer: https://www.dcode.fr/regular-expression-analyser' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'Cookie: $cookie' \
-H 'TE: Trailers' \
--data "tool=regular-expression-analyser®exp=$g&max_length=true" | \
jq -r .results;
sleep 1;
done