-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
297 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,12 @@ | ||
import Server from "https:/deno.land/x/lume/core/server.ts"; | ||
import expires from "https:/deno.land/x/lume/middlewares/expires.ts"; | ||
import notFound from "https://deno.land/x/[email protected]/middlewares/not_found.ts"; | ||
import { sleep } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
const server = new Server({ | ||
port: 8000, | ||
root: `${Deno.cwd()}/_site`, | ||
}); | ||
|
||
// Rate limiting (max 20 requests per 10 seconds) | ||
const maxRequests = 20; | ||
const interval = 10000; | ||
const rateLimitter = { | ||
requestCount: 0, | ||
lastResetTime: Date.now(), | ||
}; | ||
|
||
server.use(async (request, next, conn) => { | ||
const response = await next(request); | ||
|
||
const url = request.url; | ||
|
||
const remoteAddr = conn.remoteAddr; | ||
|
||
const currentTime = Date.now(); | ||
|
||
// Reset rateLimitter after elapsing interval | ||
if (currentTime - rateLimitter.lastResetTime > interval) { | ||
rateLimitter.requestCount = 0; | ||
rateLimitter.lastResetTime = currentTime; | ||
} | ||
|
||
// Rate limiting | ||
if (rateLimitter.requestCount < maxRequests) { | ||
rateLimitter.requestCount += 1; | ||
} else { | ||
console.log(`Rate limiting for ${JSON.stringify(remoteAddr)}. URL: ${url}. Sleep 30 seconds.`); | ||
await sleep(30); | ||
} | ||
|
||
await sleep(1); | ||
|
||
return response; | ||
}); | ||
|
||
// Not found | ||
server.use(notFound({ | ||
root: `${Deno.cwd()}/_site`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ploit/windows/privilege-escalation/activate-administrator-account-on-windows.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: Activate Administrator Account on Windows | ||
description: | ||
tags: | ||
- Privilege Escalation | ||
- Windows | ||
refs: | ||
date: 2024-04-01 | ||
draft: false | ||
--- | ||
|
||
Open PowerShell as **Administrator**. | ||
|
||
```powershell | ||
net user administrator /active:yes | ||
``` | ||
|
||
Now you can sign in to Administrator account. | ||
|
||
After that, you should disable Administrator account as below: | ||
|
||
```powershell | ||
net user administrator /active:no | ||
``` |
79 changes: 79 additions & 0 deletions
79
src/exploit/windows/privilege-escalation/add-edit-delete-users-on-windows.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
title: Add/Edit/Delete Users on Windows | ||
description: | ||
tags: | ||
- Privilege Escalation | ||
- Windows | ||
refs: | ||
date: 2024-04-01 | ||
draft: false | ||
--- | ||
|
||
## Add New User | ||
|
||
```powershell | ||
net user /add <username> <password> | ||
net user /add /domain <username> <password> | ||
``` | ||
|
||
### with SecureString Password | ||
|
||
```powershell | ||
$Username = "John" | ||
$Password = ConvertTo-SecureString "MyPassword123@" -AsPlainText -Force | ||
$FullName = "John Doe" | ||
$Description = "My new account" | ||
$HomeDir = "C:\Users\John" | ||
# Create new user | ||
New-LocalUser -Name $Username -Password $Password -FullName $FullName -Description $Description -PasswordNeverExpires | ||
# Add to "Users" local group | ||
Add-LocalGroupMember -Group Users -Member $Username | ||
``` | ||
|
||
Now reboot Windows computer and you can sign in the new account. | ||
|
||
<br /> | ||
|
||
## Add User to Local Group | ||
|
||
```powershell | ||
# Add to the Administrators group. | ||
net localgroup Administrators <username> /add | ||
# Add to the WinRM group. | ||
net localgroup "Remote Managment Users" <username> /add | ||
# Add to the RDP group. | ||
net localgroup "Remote Desktop Users" <username> /add | ||
``` | ||
|
||
If we could add an user to the WinRM or RDP group, we can login **WinRM** or **RDP** with the user credential. | ||
|
||
<br /> | ||
|
||
## Change User Password | ||
|
||
```powershell | ||
net user <username> <new-password> | ||
``` | ||
|
||
<br /> | ||
|
||
## Delete User | ||
|
||
```powershell | ||
net user <username> /delete | ||
``` | ||
|
||
<br /> | ||
|
||
## Delete User From Local Group | ||
|
||
```powershell | ||
# Delete from the Administrators group. | ||
net localgroup Administrators <username> /delete | ||
# Delete from the WinRM group. | ||
net localgroup "Remote Management Users" <username> /delete | ||
``` |
Oops, something went wrong.