Skip to content

Commit

Permalink
[AHK] Automatic update 👽
Browse files Browse the repository at this point in the history
  • Loading branch information
snovvcrash committed Aug 4, 2022
1 parent e438b34 commit 87e8846
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 101 deletions.
20 changes: 7 additions & 13 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Table of Contents

## Pentest
## Pentest ⚒️

* [C2](pentest/c2/README.md)
- [Covenant](pentest/c2/covenant.md)
- [Empire](pentest/c2/empire.md)
- [Metasploit](pentest/c2/metasploit.md)
- [PoshC2](pentest/c2/poshc2.md)
- [Sliver](pentest/c2/sliver.md)
* [Misc](pentest/misc/README.md)
- [OSCP BOF](pentest/misc/oscp-bof.md)
- [RE](pentest/misc/re.md)
* [Infrastructure](pentest/infrastructure/README.md)
- [AD](pentest/infrastructure/ad/README.md)
* [ACL Abuse](pentest/infrastructure/ad/acl-abuse.md)
Expand Down Expand Up @@ -129,6 +126,9 @@
- [SNMP](pentest/infrastructure/snmp.md)
- [TFTP](pentest/infrastructure/tftp.md)
- [VNC](pentest/infrastructure/vnc.md)
* [Misc](pentest/misc/README.md)
- [OSCP BOF](pentest/misc/oscp-bof.md)
- [RE](pentest/misc/re.md)
* [OSINT](pentest/osint/README.md)
- [Shodan](pentest/osint/shodan.md)
* [Password Brute Force](pentest/password-brute-force/README.md)
Expand Down Expand Up @@ -166,7 +166,7 @@
* [Enterprise](pentest/wi-fi/wpa-wpa2/enterprise.md)
* [Personal](pentest/wi-fi/wpa-wpa2/personal.md)

## Red Team
## Red Team 🐞

* [Basics](redteam/basics.md)
* [Cobalt Strike](redteam/cobalt-strike.md)
Expand All @@ -192,8 +192,9 @@
* [HTML Smuggling](redteam/se/phishing/html-smuggling.md)
* [MS Office](redteam/se/phishing/ms-office.md)

## Admin
## Admin ⚙️

* [Git](admin/git.md)
* [Linux](admin/linux/README.md)
- [Kali](admin/linux/kali.md)
* [Networking](admin/networking/README.md)
Expand All @@ -206,10 +207,3 @@
- [VirtualBox](admin/virtualization/virtualbox.md)
- [VMWare](admin/virtualization/vmware.md)
* [Windows](admin/windows.md)

## Dev

* [C / C++](dev/c-cpp.md)
* [Git](dev/git.md)
* [Python](dev/python/README.md)
- [Code Snippets](dev/python/code-snippets.md)
File renamed without changes.
68 changes: 0 additions & 68 deletions dev/c-cpp.md

This file was deleted.

20 changes: 0 additions & 20 deletions dev/python/code-snippets.md

This file was deleted.

67 changes: 67 additions & 0 deletions redteam/maldev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,73 @@ shellcode = (unsigned char*)malloc(shellcodeSize);
memcpy(shellcode, scResourceData, shellcodeSize);
```
An alternative way to get the nearest return address in current stack frame (besides [\_ReturnAddress](https://docs.microsoft.com/ru-ru/cpp/intrinsics/returnaddress?view=msvc-170) and [\_AddressOfReturnAddress](https://docs.microsoft.com/ru-ru/cpp/intrinsics/addressofreturnaddress?view=msvc-170)) without manually walking the stack:
{% code title="retaddr.cpp" %}
```cpp
#include <intrin.h>
#include <windows.h>
#include <iostream>
#include <sstream>
#include <iomanip>
// https://github.com/mgeeky/ThreadStackSpoofer/blob/f67caea38a7acdb526eae3aac7c451a08edef6a9/ThreadStackSpoofer/header.h#L38-L45
template<class... Args>
void log(Args... args)
{
std::stringstream oss;
(oss << ... << args);
std::cout << oss.str() << std::endl;
}
// https://github.com/mgeeky/ThreadStackSpoofer/blob/f67caea38a7acdb526eae3aac7c451a08edef6a9/ThreadStackSpoofer/main.cpp#L13-L14
void addressOfReturnAddress() {
auto pRetAddr = (PULONG_PTR)_AddressOfReturnAddress(); // https://doxygen.reactos.org/d6/d8c/intrin__ppc_8h_source.html#l00040
log("Original return address via _AddressOfReturnAddress: 0x", std::hex, std::setw(8), std::setfill('0'), *pRetAddr);
}
// https://stackoverflow.com/a/1334586/6253579
void rtlCaptureStackBackTrace() {
typedef USHORT(WINAPI* CaptureStackBackTraceType)(__in ULONG, __in ULONG, __out PVOID*, __out_opt PULONG);
CaptureStackBackTraceType RtlCaptureStackBackTrace = (CaptureStackBackTraceType)(GetProcAddress(LoadLibrary("ntdll.dll"), "RtlCaptureStackBackTrace"));
void* callers[2] = { NULL };
int count = (RtlCaptureStackBackTrace)(1, 2, callers, NULL);
log("Original return address via RtlCaptureStackBackTrace: 0x", std::hex, std::setw(8), std::setfill('0'), (DWORD64)callers[0]);
}
int main(int argc, char** argv)
{
addressOfReturnAddress();
rtlCaptureStackBackTrace();
return 0;
}
```
{% endcode %}



### Python

Run OS command:

{% code title="runCmd.py" %}
```python
import subprocess, shlex

def run_command(command):
process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
while True:
output = process.stdout.readline().decode()
if output == '' and process.poll() is not None:
break
if output:
print(output.strip())
res = process.poll()
return res
```
{% endcode %}




Expand Down

0 comments on commit 87e8846

Please sign in to comment.