Skip to content

Commit 6237010

Browse files
streamlined ansible playbook
1 parent e6bfd96 commit 6237010

9 files changed

Lines changed: 36 additions & 42 deletions

File tree

bbot/core/helpers/misc.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,14 +2088,34 @@ def cpu_architecture():
20882088
import platform
20892089

20902090
uname = platform.uname()
2091-
arch = uname.machine.lower()
2091+
return uname.machine.lower()
2092+
2093+
2094+
def cpu_architecture_golang():
2095+
"""
2096+
CPU architecture for GoLang release binaries.
2097+
"""
2098+
arch = cpu_architecture()
2099+
# golang uses "arm64" instead of "aarch64"
20922100
if arch.startswith("aarch"):
20932101
return "arm64"
2094-
elif arch == "x86_64":
2102+
# golang uses "amd64" instead of "x86_64"
2103+
if arch == "x86_64":
20952104
return "amd64"
20962105
return arch
20972106

20982107

2108+
def cpu_architecture_rust():
2109+
"""
2110+
CPU architecture for Rust release binaries.
2111+
"""
2112+
arch = cpu_architecture()
2113+
# rust uses "arm64" instead of "aarch64"
2114+
if arch.startswith("aarch"):
2115+
return "arm64"
2116+
return arch
2117+
2118+
20992119
def os_platform():
21002120
"""Return the OS platform of the current system.
21012121

bbot/core/shared_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "Download ffuf",
44
"unarchive": {
5-
"src": "https://github.com/ffuf/ffuf/releases/download/v#{BBOT_DEPS_FFUF_VERSION}/ffuf_#{BBOT_DEPS_FFUF_VERSION}_#{BBOT_OS}_#{BBOT_CPU_ARCH}.tar.gz",
5+
"src": "https://github.com/ffuf/ffuf/releases/download/v#{BBOT_DEPS_FFUF_VERSION}/ffuf_#{BBOT_DEPS_FFUF_VERSION}_#{BBOT_OS}_#{BBOT_CPU_ARCH_GOLANG}.tar.gz",
66
"include": "ffuf",
77
"dest": "#{BBOT_TOOLS}",
88
"remote_src": True,

bbot/modules/deadly/legba.py

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,43 +56,15 @@ class legba(BaseModule):
5656

5757
deps_ansible = [
5858
{
59-
"name": "Download legba (x86)",
59+
"name": "Download legba",
6060
"unarchive": {
61-
"src": "https://github.com/evilsocket/legba/releases/download/#{BBOT_MODULES_LEGBA_VERSION}/legba-#{BBOT_MODULES_LEGBA_VERSION}-linux-x86_64.tar.gz",
61+
"src": "https://github.com/evilsocket/legba/releases/download/#{BBOT_MODULES_LEGBA_VERSION}/legba-#{BBOT_MODULES_LEGBA_VERSION}-#{BBOT_OS}-#{BBOT_CPU_ARCH_RUST}.tar.gz",
6262
"dest": "#{BBOT_TEMP}",
63-
"include": "legba-#{BBOT_MODULES_LEGBA_VERSION}-linux-x86_64/legba",
63+
"include": "legba-#{BBOT_MODULES_LEGBA_VERSION}-#{BBOT_OS}-#{BBOT_CPU_ARCH_RUST}/legba",
6464
"remote_src": True,
65-
},
66-
"when": "ansible_facts['system'] == 'Linux' and ansible_facts['architecture'] == 'x86_64'",
67-
},
68-
{
69-
"name": "Install legba (x86)",
70-
"copy": {
71-
"src": "#{BBOT_TEMP}/legba-#{BBOT_MODULES_LEGBA_VERSION}-linux-x86_64/legba",
72-
"dest": "#{BBOT_TOOLS}/",
73-
"mode": "u+x,g+x,o+x",
74-
},
75-
"when": "ansible_facts['system'] == 'Linux' and ansible_facts['architecture'] == 'x86_64'",
76-
},
77-
{
78-
"name": "Download legba (ARM64)",
79-
"unarchive": {
80-
"src": "https://github.com/evilsocket/legba/releases/download/#{BBOT_MODULES_LEGBA_VERSION}/legba-#{BBOT_MODULES_LEGBA_VERSION}-linux-arm64.tar.gz",
81-
"dest": "#{BBOT_TEMP}",
82-
"include": "legba-#{BBOT_MODULES_LEGBA_VERSION}-linux-arm64/legba",
83-
"remote_src": True,
84-
},
85-
"when": "ansible_facts['system'] == 'Linux' and ansible_facts['architecture'] == 'aarch64'",
86-
},
87-
{
88-
"name": "Install legba (ARM64)",
89-
"copy": {
90-
"src": "#{BBOT_TEMP}/legba-#{BBOT_MODULES_LEGBA_VERSION}-linux-arm64/legba",
91-
"dest": "#{BBOT_TOOLS}/",
9265
"mode": "u+x,g+x,o+x",
93-
},
94-
"when": "ansible_facts['system'] == 'Linux' and ansible_facts['architecture'] == 'aarch64'",
95-
},
66+
}
67+
}
9668
]
9769

9870
async def setup(self):

bbot/modules/fingerprintx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class fingerprintx(BaseModule):
2525
{
2626
"name": "Download fingerprintx",
2727
"unarchive": {
28-
"src": "https://github.com/praetorian-inc/fingerprintx/releases/download/v#{BBOT_MODULES_FINGERPRINTX_VERSION}/fingerprintx_#{BBOT_MODULES_FINGERPRINTX_VERSION}_#{BBOT_OS_PLATFORM}_#{BBOT_CPU_ARCH}.tar.gz",
28+
"src": "https://github.com/praetorian-inc/fingerprintx/releases/download/v#{BBOT_MODULES_FINGERPRINTX_VERSION}/fingerprintx_#{BBOT_MODULES_FINGERPRINTX_VERSION}_#{BBOT_OS_PLATFORM}_#{BBOT_CPU_ARCH_GOLANG}.tar.gz",
2929
"include": "fingerprintx",
3030
"dest": "#{BBOT_TOOLS}",
3131
"remote_src": True,

bbot/modules/gowitness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class gowitness(BaseModule):
4343
{
4444
"name": "Download gowitness",
4545
"get_url": {
46-
"url": "https://github.com/sensepost/gowitness/releases/download/#{BBOT_MODULES_GOWITNESS_VERSION}/gowitness-#{BBOT_MODULES_GOWITNESS_VERSION}-#{BBOT_OS_PLATFORM}-#{BBOT_CPU_ARCH}",
46+
"url": "https://github.com/sensepost/gowitness/releases/download/#{BBOT_MODULES_GOWITNESS_VERSION}/gowitness-#{BBOT_MODULES_GOWITNESS_VERSION}-#{BBOT_OS_PLATFORM}-#{BBOT_CPU_ARCH_GOLANG}",
4747
"dest": "#{BBOT_TOOLS}/gowitness",
4848
"mode": "755",
4949
},

bbot/modules/httpx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class httpx(BaseModule):
3838
{
3939
"name": "Download httpx",
4040
"unarchive": {
41-
"src": "https://github.com/projectdiscovery/httpx/releases/download/v#{BBOT_MODULES_HTTPX_VERSION}/httpx_#{BBOT_MODULES_HTTPX_VERSION}_#{BBOT_OS}_#{BBOT_CPU_ARCH}.zip",
41+
"src": "https://github.com/projectdiscovery/httpx/releases/download/v#{BBOT_MODULES_HTTPX_VERSION}/httpx_#{BBOT_MODULES_HTTPX_VERSION}_#{BBOT_OS}_#{BBOT_CPU_ARCH_GOLANG}.zip",
4242
"include": "httpx",
4343
"dest": "#{BBOT_TOOLS}",
4444
"remote_src": True,

bbot/modules/nuclei.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class nuclei(BaseModule):
5050
{
5151
"name": "Download nuclei",
5252
"unarchive": {
53-
"src": "https://github.com/projectdiscovery/nuclei/releases/download/v#{BBOT_MODULES_NUCLEI_VERSION}/nuclei_#{BBOT_MODULES_NUCLEI_VERSION}_#{BBOT_OS}_#{BBOT_CPU_ARCH}.zip",
53+
"src": "https://github.com/projectdiscovery/nuclei/releases/download/v#{BBOT_MODULES_NUCLEI_VERSION}/nuclei_#{BBOT_MODULES_NUCLEI_VERSION}_#{BBOT_OS}_#{BBOT_CPU_ARCH_GOLANG}.zip",
5454
"include": "nuclei",
5555
"dest": "#{BBOT_TOOLS}",
5656
"remote_src": True,

bbot/modules/trufflehog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class trufflehog(BaseModule):
3131
{
3232
"name": "Download trufflehog",
3333
"unarchive": {
34-
"src": "https://github.com/trufflesecurity/trufflehog/releases/download/v#{BBOT_MODULES_TRUFFLEHOG_VERSION}/trufflehog_#{BBOT_MODULES_TRUFFLEHOG_VERSION}_#{BBOT_OS_PLATFORM}_#{BBOT_CPU_ARCH}.tar.gz",
34+
"src": "https://github.com/trufflesecurity/trufflehog/releases/download/v#{BBOT_MODULES_TRUFFLEHOG_VERSION}/trufflehog_#{BBOT_MODULES_TRUFFLEHOG_VERSION}_#{BBOT_OS_PLATFORM}_#{BBOT_CPU_ARCH_GOLANG}.tar.gz",
3535
"include": "trufflehog",
3636
"dest": "#{BBOT_TOOLS}",
3737
"remote_src": True,

bbot/scanner/preset/environ.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import omegaconf
44
from pathlib import Path
55

6-
from bbot.core.helpers.misc import cpu_architecture, os_platform, os_platform_friendly
6+
from bbot.core.helpers.misc import cpu_architecture, cpu_architecture_golang, cpu_architecture_rust, os_platform, os_platform_friendly
77

88

99
REQUESTS_PATCHED = False
@@ -103,6 +103,8 @@ def prepare(self):
103103
environ["BBOT_OS_PLATFORM"] = os_platform()
104104
environ["BBOT_OS"] = os_platform_friendly()
105105
environ["BBOT_CPU_ARCH"] = cpu_architecture()
106+
environ["BBOT_CPU_ARCH_GOLANG"] = cpu_architecture_golang()
107+
environ["BBOT_CPU_ARCH_RUST"] = cpu_architecture_rust()
106108

107109
# copy config to environment
108110
bbot_environ = self.flatten_config(self.preset.config)

0 commit comments

Comments
 (0)