-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathbrowser.sh
More file actions
executable file
·71 lines (64 loc) · 1.36 KB
/
Copy pathbrowser.sh
File metadata and controls
executable file
·71 lines (64 loc) · 1.36 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
#!/usr/bin/env bash
HEADER="User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"
CONNECTION_TIME="15"
TRANSMISSION_TIME="15"
get() {
URL="$1"
curl -s \
--connect-timeout "$CONNECTION_TIME" \
-m "$TRANSMISSION_TIME" \
-H "'$HEADER'" \
"$URL"
}
getFollowRedirect() {
URL="$1"
curl -s \
--connect-timeout "$CONNECTION_TIME" \
-m "$TRANSMISSION_TIME" \
-H "$HEADER" \
-L "$URL"
}
post() {
URL="$1"
PAYLOAD="$2"
wget --quiet \
--header "'$HEADER'" \
--method POST \
--body-data "$PAYLOAD" \
--output-document \
- "$URL"
}
getCookies() {
URL="$1"
curl -s \
--connect-timeout "$CONNECTION_TIME" \
-m "$TRANSMISSION_TIME" \
-H "'$HEADER'" \
-c- "$URL"
}
urlencode() {
string=$1; format=; set --
while
literal=${string%%[!-._~0-9A-Za-z]*}
case "$literal" in
?*)
format=$format%s
set -- "$@" "$literal"
string=${string#$literal};;
esac
case "$string" in
"") false;;
esac
do
tail=${string#?}
head=${string%$tail}
format=$format%%%02x
set -- "$@" "'$head"
string=$tail
done
printf "$format\\n" "$@"
}
urldecode() {
local url_encoded="${1//+/ }"
printf '%b' "${url_encoded//%/\\x}"
}