Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/library/execution/Randomizing_User-Agent_in_Google_Chrome/payload.txt
2971 views
1
REM_BLOCK
2
#############################################################
3
# #
4
# Title : Randomizing User-Agent in Google Chrome #
5
# Author : Aleff #
6
# Version : 1.0 #
7
# Category : Execution #
8
# Target : Chrome on Linux (Tested on Ubuntu) #
9
# #
10
#############################################################
11
END_REM
12
13
REM Replace it with your sudo user password
14
DEFINE #SUDO_PSWD example
15
16
REM May it depends...
17
DEFAULT_DELAY 250
18
19
REM Define if you want to erase the tracks of your commands
20
DEFINE I_WANT_TO_ERASE_THE_SHELL_TRACKS FALSE
21
22
REM_BLOCK
23
Credits: Hak5 LLC
24
Website: https://hak5.org/
25
Source: https://github.com/hak5/usbrubberducky-payloads/blob/master/payloads/extensions/detect_ready.txt
26
END_REM
27
28
EXTENSION DETECT_READY
29
REM VERSION 1.1
30
REM AUTHOR: Korben
31
32
REM_BLOCK DOCUMENTATION
33
USAGE:
34
Extension runs inline (here)
35
Place at beginning of payload (besides ATTACKMODE) to act as dynamic
36
boot delay
37
38
TARGETS:
39
Any system that reflects CAPSLOCK will detect minimum required delay
40
Any system that does not reflect CAPSLOCK will hit the max delay of 3000ms
41
END_REM
42
43
REM CONFIGURATION:
44
DEFINE #RESPONSE_DELAY 25
45
DEFINE #ITERATION_LIMIT 120
46
47
VAR $C = 0
48
WHILE (($_CAPSLOCK_ON == FALSE) && ($C < #ITERATION_LIMIT))
49
CAPSLOCK
50
DELAY #RESPONSE_DELAY
51
$C = ($C + 1)
52
END_WHILE
53
CAPSLOCK
54
END_EXTENSION
55
56
CTRL-ALT t
57
DELAY 1000
58
59
STRINGLN_BASH
60
echo '#!/bin/bash' > .randomize_user_agent
61
echo 'UA=$(torify curl "https://user-agents.net/random" -H "content-type: application/x-www-form-urlencoded" -H "referer: https://user-agents.net/random" --data-raw "limit=1&action=generate")' >> .randomize_user_agent
62
echo 're="<li><a href=\".+\">(.+)<\/a><\/li>"' >> .randomize_user_agent
63
echo 'if [[ $UA =~ $re ]]; then
64
/usr/bin/google-chrome-stable --user-agent="${BASH_REMATCH[1]}"
65
else
66
/usr/bin/google-chrome-stable
67
fi' >> .randomize_user_agent
68
sudo chmod +x .randomize_user_agent
69
END_STRINGLN
70
71
DELAY 750
72
73
STRINGLN_BASH
74
#SUDO_PSWD
75
NEW_STRING="/home/$(whoami)/.randomize_user_agent"
76
awk -v new="$NEW_STRING" '{gsub("/usr/bin/google-chrome-stable", new)}1' /usr/share/applications/google-chrome.desktop > tmp
77
sudo tee /usr/share/applications/google-chrome.desktop < tmp
78
gtk-update-icon-cache
79
END_STRINGLN
80
81
IF_DEFINED_TRUE #I_WANT_TO_ERASE_THE_SHELL_TRACKS
82
STRINGLN rm $HISTFILE; exit
83
END_IF_DEFINED
84
85