Guest User

List Linux sockets accessible by this user.

a guest
May 18th, 2026
113
0
292 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | Software | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <sys/socket.h>
  4. #include <errno.h>
  5. int main()
  6. {
  7.     for (int i = 0; i <= 256; i++)
  8.     {
  9.         int s = socket(i,0,0);
  10.         if (errno == 97) {continue;}
  11.         if (errno ==  1) {printf("socket(%02i) -> %03i: This user does not have access to this socket.\n",i,errno); continue;}
  12.         printf("socket(%02i) -> %03i: This user has access to this socket.\n",i,errno);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment