Commit 01d5f47 Raphaël Droz
committed Nov 19, 2018
1 parent b294959 commit 01d5f47 Copy full SHA for 01d5f47
File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # cookie="60gpD=xxx; PHPSESSID=xxx"
4
+
5
+ [[ -z $cookie ]] && exit 1
6
+
7
+ urlencode () {
8
+ python3 -c ' import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]));' " $1 "
9
+ }
10
+
11
+ jq -r ' .[]|.' < postalcodes.json | \
12
+ grep -F ^ | \
13
+ sed -r -e ' s/\{([0-9])\}/{\1,\1}/g' -e ' s/\^|\$/\//g' -e ' s/\\([()])/\1/g' | \
14
+ sort -u | \
15
+ while read -r f; do
16
+ g=$( urlencode " $f " ) ;
17
+ echo " $f " ;
18
+ curl -s ' https://www.dcode.fr/api/' \
19
+ -H ' User-Agent: Mozilla/5.0' \
20
+ -H ' Accept: application/json, text/javascript, */*;' \
21
+ -H ' Referer: https://www.dcode.fr/regular-expression-analyser' \
22
+ -H ' Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
23
+ -H ' X-Requested-With: XMLHttpRequest' \
24
+ -H ' Cookie: $cookie' \
25
+ -H ' TE: Trailers' \
26
+ --data " tool=regular-expression-analyser®exp=$g &max_length=true" | \
27
+ jq -r .results;
28
+ sleep 1;
29
+ done
Original file line number Diff line number Diff line change
1
+ 10
2
+ # Current maximum postal code size is 10
3
+ # Countries: US, AS, IR
You can’t perform that action at this time.
0 commit comments