MCPcopy Create free account
hub / github.com/LMS57/TempleOfPwn / setup

Function setup

shellcode/shellcode.c:132–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132void setup(){
133 serv.sin_family = AF_INET;
134 serv.sin_port = htons(8096); //Define the port at which the server will listen for connections.
135 serv.sin_addr.s_addr = INADDR_ANY;
136 fd = socket(AF_INET, SOCK_STREAM, 0); //This will create a new socket and also return the identifier of the socket into fd.
137 // To handle errors, you can add an if condition that checks whether fd is greater than 0. If it isn't, prompt an error
138 while(1){
139 int t = bind(fd, (struct sockaddr *)&serv, sizeof(serv)); //assigns the address specified by serv to the socket
140 if(t == 0){
141 break;
142 }
143 printf("Problem with setting up the port\n");
144 exit(0);
145 }
146 listen(fd,5); //Listen for client connections. Maximum 5 connections will be permitted.
147 return;
148}
149
150int main(){
151 char message[16] = ""; //This array will store the messages that are sent by the server

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected