Sponsored Content
Full Discussion: Shellcode Generation using C
Top Forums Programming Shellcode Generation using C Post 302139514 by Legend986 on Sunday 7th of October 2007 10:03:36 PM
Old 10-07-2007
Shellcode Generation using C

Hi,

I was just learning about buffer overflow attacks... I was curious as to how to generate a simple shellcode. I've written two codes - One is the typical program that has a vulnerability inside and the other is the shellcode.

main program:
Code:
void test();

int main() {
   test();
   return 0;
}

void test() {
   int *ret;
   ret = (int *)&ret + 2;
   (*ret) = (int)shellcode;
}


I was thinking of putting the shellcode into the shellcode found in the end which is a character array.

And as for the shellcode generation, I've written something like:

Code:
#include <unistd.h>

int main() {
  char buf[]="Hello World";
  write(1,buf,sizeof(buf));
  exit(0);
}


But I don't know how to generate the shellcode from this so that I can put it in the original program in the form of char shellcode[] = ...... How would I go about doing this? And yeah if this is the wrong forum, please move this post because I didn't know where else this has to be posted...
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

report generation

Hello, I got a requirement in writing a sheel script in unix, please help me out the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2. I would like to compare all the... (2 Replies)
Discussion started by: gmahesh2k
2 Replies

2. Shell Programming and Scripting

Report generation

Hello, I got a requirement in writing a KSH script in unix, please help me out the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2. I would like to compare all the similar... (3 Replies)
Discussion started by: gmahesh2k
3 Replies

3. Shell Programming and Scripting

Graph generation

How can I generate graphs using perl in unix solaris environment? Please suggest. (2 Replies)
Discussion started by: wadhwa.pooja
2 Replies

4. Shell Programming and Scripting

Help with excelsheet generation

Hi All, i have around 50 queries in sybase. We have a requirement where we need to write a unix script, which execute the query one by one & generate the excel sheet & send it to user. I have completed half of the part, where i am executing query one by one & putting the result into a .txt... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies

5. Programming

Passing arguments to shellcode

Is there any way I could pass arguments to shellcode. My goal is to store a program in a image file, and have another program read and run the code with arguments in memory. Currently I can store a program in a image file, then read it back to the hard-drive run it normally then delete it when... (5 Replies)
Discussion started by: image28
5 Replies

6. UNIX for Dummies Questions & Answers

Difference Shellcode and Shell scripting

Heey guys I am new to Unix and got a question on scripting (bash etc.) I now and then stumble into some tutorials on shellcoding after which I completely lose it. The question is: what is the difference between shellcoding, shell scripting and shell programming. I searched on google, but it... (1 Reply)
Discussion started by: Kealthes
1 Replies

7. Cybersecurity

basic shellcode - why it runs on my system, if .data is not executable

Greetings, Suppose we have this piece of code, on Linux/i686 (my machine is Slackware Linux 13.1, 32 bit): char sc= /* 24 bytes */ "\x31\xc0" /* xorl %eax,%eax */ "\x50" /* pushl %eax ... (2 Replies)
Discussion started by: aigoia
2 Replies
PHALANX(6)							   Games Manual 							PHALANX(6)

NAME
Phalanx - Chess playing program SYNOPSIS
phalanx [options] [<moves> <minutes> [<increment in seconds>]] phalanx [options] [<seconds per move>] phalanx bench phalanx bcreate [options] DESCRIPTION
This manual page documents briefly the phalanx program. This manual page was written for the Debian GNU/Linux distribution (but may be used by others), because the original program does not have a manual page. phalanx is a chess playing program. It is partially xboard compatible. Under xboard, it can play games, force & undo moves, and show thinking. In this version, you cannot set positions with xboard. It is also possible to run phalanx without xboard. Do phalanx -? to get a list of command line options. One important command of pha- lanx's ASCII interface is help. phalanx uses (traditional) 10x12 board implementation. There are three often used board implementations: "8x8" (GNU Chess), "bitboard" (Crafty), and "10x12" (Nimzo, Phalanx). In short, "10x12" is easy to implement and the code is small (==fast on PC). Opening book is small, simple, hand-written. OPTIONS
-t <transposition table size in kilobytes> -f <fixed search time in seconds> -x <+/-> xboard mode on/off default: on -p <+/-> permanent brain on/off default: off -s <+/-> show thinking on/off default: off -c <+/-> cpu time default: off -o <+/-> polling input default: on -b <+/-> opening book default: on -r <resign value in centipawns> default: 0 (no resigning) -e <easy level 0...100> default: 0 (best play) -l <+/-> learning on/off default: on -v print version and exit -P <primary book directory> -S <secondary book directory> -L <learning file directory> -g <log file name> EXAMPLES
phalanx -c+ -s+ -o - -x- -f 60 -t4000 xboard -fcp "phalanx -l+ -r800" SEE ALSO
/usr/share/doc/phalanx, xboard(6) AUTHOR
Phalanx was written by Dusan Dobes <dobes@math.muni.cz>. This manual page was written by Stephen Stafford <bagpuss@debian.org> for the Debian GNU/Linux project, but may be used by others. It was written with the assistance of help2man(1) and then edited slightly to clean it up. Phalanx XXII May 2001 PHALANX(6)
All times are GMT -4. The time now is 03:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy