mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-14 00:47:24 +00:00
a
This commit is contained in:
parent
11e343c5e7
commit
dfad3c9eae
3 changed files with 39 additions and 2 deletions
BIN
consumer
Executable file
BIN
consumer
Executable file
Binary file not shown.
37
consumer.c
Normal file
37
consumer.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
// gcc consumer.c -o consumer -lrt
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
const char *name = "/my_shared_memory";
|
||||
const int SIZE = 4096; // Size of the shared memory object
|
||||
|
||||
// Open the shared memory object
|
||||
int shm_fd = shm_open(name, O_RDONLY, 0666);
|
||||
if (shm_fd == -1) {
|
||||
perror("shm_open");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Memory map the shared memory
|
||||
void *ptr = mmap(0, SIZE, PROT_READ, MAP_SHARED, shm_fd, 0);
|
||||
if (ptr == MAP_FAILED) {
|
||||
perror("mmap");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Read from the shared memory
|
||||
printf("Consumer received: %s\n", (char *)ptr);
|
||||
|
||||
// Cleanup
|
||||
munmap(ptr, SIZE);
|
||||
close(shm_fd);
|
||||
shm_unlink(name); // Optionally unlink
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ Other ways to support HackTricks:
|
|||
|
||||
</details>
|
||||
|
||||
<figure><img src="/.gitbook/assets/WebSec_1500x400_10fps_21sn_lightoptimized_v2.gif" alt=""><figcaption></figcaption></figure>
|
||||
<figure><img src="https://pentest.eu/RENDER_WebSec_10fps_21sec_9MB_29042024.gif" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
{% embed url="https://websec.nl/" %}
|
||||
|
||||
|
@ -51,7 +51,7 @@ rlogin <IP> -l <username>
|
|||
find / -name .rhosts
|
||||
```
|
||||
|
||||
<figure><img src="/.gitbook/assets/WebSec_1500x400_10fps_21sn_lightoptimized_v2.gif" alt=""><figcaption></figcaption></figure>
|
||||
<figure><img src="https://pentest.eu/RENDER_WebSec_10fps_21sec_9MB_29042024.gif" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
{% embed url="https://websec.nl/" %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue