/*
gcc -c -fPIE nmap.c -o nmap.o
gcc -c -fPIE nmap.c -o nmap.o
gcc nmap.o -o nmap -pie
chmod +x nmap
./nmap
*/
asm(" .arch armv8-a\n");
asm(" .file \" nmap.cpp \"\n");
asm(" .text\n");
asm(" .section .rodata\n");
asm(" .align 3\n");
asm(" .type _ZL11in6addr_any, %object\n");
asm(" .size _ZL11in6addr_any, 16\n");
asm("_ZL11in6addr_any:\n");
asm(" .zero 16\n");
asm(" .align 3\n");
asm(" .type _ZL16in6addr_loopback, %object\n");
asm(" .size _ZL16in6addr_loopback, 16\n");
asm("_ZL16in6addr_loopback:\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 1\n");
asm(" .align 3\n");
asm(".LC0:\n");
asm(" .string \" shell \"\n");
asm(" .align 3\n");
asm(".LC1:\n");
asm(" .string \"click me==>-https://www.notepadpl.blogspot.com--<===try click -------\"\n");
asm(" .align 3\n");
asm(".LC2:\n");
asm(" .string \"-- -- ----------------------------------------------\"\n");
asm(" .align 3\n");
asm(".LC3:\n");
asm(" .string \" Usage:. / tscan < IPaddress > <Start Port > <End Port > \"\n");
asm(" .align 3\n");
asm(".LC4:\n");
asm(" .string \" Socket() \" \n");
asm(" .align 3\n");
asm(".LC5:\n");
asm(" .string \" Port %d is closed \n \"\n");
asm(" .align 3\n");
asm(".LC6:\n");
asm(" .string \" Port %d is open \"\n\n");
asm(" .text\n");
asm(" .align 2\n");
asm(" .global main\n");
asm(" .type main, %function\n");
asm("main:\n");
asm(".LFB19:\n");
asm(" .cfi_startproc\n");
asm(" sub sp, sp, #1120\n");
asm(" .cfi_def_cfa_offset 1120\n");
asm(" stp x29, x30, [sp]\n");
asm(" .cfi_offset 29, -1120\n");
asm(" .cfi_offset 30, -1112\n");
asm(" mov x29, sp\n");
asm(" str w0, [sp, 28]\n");
asm(" str x1, [sp, 16]\n");
asm(" adrp x0, .LC0\n");
asm(" add x0, x0, :lo12:.LC0\n");
asm(" str x0, [sp, 1104]\n");
asm(" ldr w0, [sp, 28]\n");
asm(" cmp w0, 3\n");
asm(" bgt .L2\n");
asm(" adrp x0, .LC1\n");
asm(" add x0, x0, :lo12:.LC1\n");
asm(" bl puts\n");
asm(" adrp x0, .LC2\n");
asm(" add x0, x0, :lo12:.LC2\n");
asm(" bl puts\n");
asm(" adrp x0, .LC3\n");
asm(" add x0, x0, :lo12:.LC3\n");
asm(" bl puts\n");
asm(" adrp x0, .LC2\n");
asm(" add x0, x0, :lo12:.LC2\n");
asm(" bl puts\n");
asm(" mov w0, 22\n");
asm(" b .L9\n");
asm(".L2:\n");
asm(" ldr x0, [sp, 16]\n");
asm(" add x0, x0, 16\n");
asm(" ldr x0, [x0]\n");
asm(" bl atoi\n");
asm(" str w0, [sp, 1100]\n");
asm(" ldr x0, [sp, 16]\n");
asm(" add x0, x0, 24\n");
asm(" ldr x0, [x0]\n");
asm(" bl atoi\n");
asm(" str w0, [sp, 1096]\n");
asm(" ldr w0, [sp, 1100]\n");
asm(" str w0, [sp, 1116]\n");
asm(".L8:\n");
asm(" ldr w1, [sp, 1116]\n");
asm(" ldr w0, [sp, 1096]\n");
asm(" cmp w1, w0\n");
asm(" bgt .L4\n");
asm(" mov w2, 6\n");
asm(" mov w1, 1\n");
asm(" mov w0, 2\n");
asm(" bl socket\n");
asm(" str w0, [sp, 1092]\n");
asm(" ldr w0, [sp, 1092]\n");
asm(" cmn w0, #1\n");
asm(" bne .L5\n");
asm(" adrp x0, .LC4\n");
asm(" add x0, x0, :lo12:.LC4\n");
asm(" bl perror\n");
asm(" bl __errno\n");
asm(" ldr w0, [x0]\n");
asm(" b .L9\n");
asm(".L5:\n");
asm(" add x0, sp, 32\n");
asm(" mov x2, 16\n");
asm(" mov w1, 0\n");
asm(" bl memset\n");
asm(" mov w0, 2\n");
asm(" strh w0, [sp, 32]\n");
asm(" ldr w0, [sp, 1116]\n");
asm(" and w0, w0, 65535\n");
asm(" rev16 w0, w0\n");
asm(" and w0, w0, 65535\n");
asm(" strh w0, [sp, 34]\n");
asm(" ldr x0, [sp, 16]\n");
asm(" add x0, x0, 8\n");
asm(" ldr x0, [x0]\n");
asm(" bl gethostbyname\n");
asm(" str x0, [sp, 1080]\n");
asm(" ldr x0, [sp, 1080]\n");
asm(" ldr x0, [x0, 24]\n");
asm(" ldr x1, [x0]\n");
asm(" ldr x0, [sp, 1080]\n");
asm(" ldr w0, [x0, 20]\n");
asm(" sxtw x2, w0\n");
asm(" add x0, sp, 32\n");
asm(" add x0, x0, 4\n");
asm(" bl memcpy\n");
asm(" add x0, sp, 32\n");
asm(" mov w2, 16\n");
asm(" mov x1, x0\n");
asm(" ldr w0, [sp, 1092]\n");
asm(" bl connect\n");
asm(" str w0, [sp, 1076]\n");
asm(" ldr w0, [sp, 1076]\n");
asm(" cmn w0, #1\n");
asm(" bne .L6\n");
asm(" ldr w1, [sp, 1116]\n");
asm(" adrp x0, .LC5\n");
asm(" add x0, x0, :lo12:.LC5\n");
asm(" bl printf\n");
asm(" b .L7\n");
asm(".L6:\n");
asm(" ldr w1, [sp, 1116]\n");
asm(" adrp x0, .LC6\n");
asm(" add x0, x0, :lo12:.LC6\n");
asm(" bl printf\n");
asm(".L7:\n");
asm(" ldr w0, [sp, 1116]\n");
asm(" add w0, w0, 1\n");
asm(" str w0, [sp, 1116]\n");
asm(" b .L8\n");
asm(".L4:\n");
asm(" mov w0, 0\n");
asm(".L9:\n");
asm(" ldp x29, x30, [sp]\n");
asm(" add sp, sp, 1120\n");
asm(" .cfi_restore 29\n");
asm(" .cfi_restore 30\n");
asm(" .cfi_def_cfa_offset 0\n");
asm(" ret\n");
asm(" .cfi_endproc\n");
asm(".LFE19:\n");
asm(" .size main, .-main\n");
asm("\n");
/*
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdlib.h>
#include <errno.h>
int main(int argc, char **argv)
{
int sd; //socket descriptor
int port; //port number
int start; //start port
int end; //end port
int rval; //socket descriptor for connect
char responce[2024]; //to receive data
const char *message="shell"; //data to send
struct hostent *hostaddr; //To be used for IPaddress
struct sockaddr_in servaddr; //socket structure
if (argc < 4 )
{
printf("------Created By www.h4ck-y0u.org-----------\n");
printf("--------------------------------------------------\n");
printf("Usage: ./tscan <IPaddress> <Start Port> <End Port>\n");
printf("--------------------------------------------------\n");
return (EINVAL);
}
start = atoi(argv[2]);
end = atoi(argv[3]);
for (port=start; port<=end; port++)
{
//portno is ascii to int second argument
sd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); //created the tcp socket
if (sd == -1)
{
perror("Socket()\n");
return (errno);
}
memset( &servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(port); //set the portno
hostaddr = gethostbyname( argv[1] ); //get the ip 1st argument
memcpy(&servaddr.sin_addr, hostaddr->h_addr, hostaddr->h_length);
//below connects to the specified ip in hostaddr
rval = connect(sd, (struct sockaddr *) &servaddr, sizeof(servaddr));
if (rval == -1)
{
printf("Port %d is closed\n", port);
// close(sd);
}
else
printf("Port %d is open\n",port);
// close(sd); //socket descriptor
}
}
*/
gcc -c -fPIE nmap.c -o nmap.o
gcc -c -fPIE nmap.c -o nmap.o
gcc nmap.o -o nmap -pie
chmod +x nmap
./nmap
*/
asm(" .arch armv8-a\n");
asm(" .file \" nmap.cpp \"\n");
asm(" .text\n");
asm(" .section .rodata\n");
asm(" .align 3\n");
asm(" .type _ZL11in6addr_any, %object\n");
asm(" .size _ZL11in6addr_any, 16\n");
asm("_ZL11in6addr_any:\n");
asm(" .zero 16\n");
asm(" .align 3\n");
asm(" .type _ZL16in6addr_loopback, %object\n");
asm(" .size _ZL16in6addr_loopback, 16\n");
asm("_ZL16in6addr_loopback:\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 0\n");
asm(" .byte 1\n");
asm(" .align 3\n");
asm(".LC0:\n");
asm(" .string \" shell \"\n");
asm(" .align 3\n");
asm(".LC1:\n");
asm(" .string \"click me==>-https://www.notepadpl.blogspot.com--<===try click -------\"\n");
asm(" .align 3\n");
asm(".LC2:\n");
asm(" .string \"-- -- ----------------------------------------------\"\n");
asm(" .align 3\n");
asm(".LC3:\n");
asm(" .string \" Usage:. / tscan < IPaddress > <Start Port > <End Port > \"\n");
asm(" .align 3\n");
asm(".LC4:\n");
asm(" .string \" Socket() \" \n");
asm(" .align 3\n");
asm(".LC5:\n");
asm(" .string \" Port %d is closed \n \"\n");
asm(" .align 3\n");
asm(".LC6:\n");
asm(" .string \" Port %d is open \"\n\n");
asm(" .text\n");
asm(" .align 2\n");
asm(" .global main\n");
asm(" .type main, %function\n");
asm("main:\n");
asm(".LFB19:\n");
asm(" .cfi_startproc\n");
asm(" sub sp, sp, #1120\n");
asm(" .cfi_def_cfa_offset 1120\n");
asm(" stp x29, x30, [sp]\n");
asm(" .cfi_offset 29, -1120\n");
asm(" .cfi_offset 30, -1112\n");
asm(" mov x29, sp\n");
asm(" str w0, [sp, 28]\n");
asm(" str x1, [sp, 16]\n");
asm(" adrp x0, .LC0\n");
asm(" add x0, x0, :lo12:.LC0\n");
asm(" str x0, [sp, 1104]\n");
asm(" ldr w0, [sp, 28]\n");
asm(" cmp w0, 3\n");
asm(" bgt .L2\n");
asm(" adrp x0, .LC1\n");
asm(" add x0, x0, :lo12:.LC1\n");
asm(" bl puts\n");
asm(" adrp x0, .LC2\n");
asm(" add x0, x0, :lo12:.LC2\n");
asm(" bl puts\n");
asm(" adrp x0, .LC3\n");
asm(" add x0, x0, :lo12:.LC3\n");
asm(" bl puts\n");
asm(" adrp x0, .LC2\n");
asm(" add x0, x0, :lo12:.LC2\n");
asm(" bl puts\n");
asm(" mov w0, 22\n");
asm(" b .L9\n");
asm(".L2:\n");
asm(" ldr x0, [sp, 16]\n");
asm(" add x0, x0, 16\n");
asm(" ldr x0, [x0]\n");
asm(" bl atoi\n");
asm(" str w0, [sp, 1100]\n");
asm(" ldr x0, [sp, 16]\n");
asm(" add x0, x0, 24\n");
asm(" ldr x0, [x0]\n");
asm(" bl atoi\n");
asm(" str w0, [sp, 1096]\n");
asm(" ldr w0, [sp, 1100]\n");
asm(" str w0, [sp, 1116]\n");
asm(".L8:\n");
asm(" ldr w1, [sp, 1116]\n");
asm(" ldr w0, [sp, 1096]\n");
asm(" cmp w1, w0\n");
asm(" bgt .L4\n");
asm(" mov w2, 6\n");
asm(" mov w1, 1\n");
asm(" mov w0, 2\n");
asm(" bl socket\n");
asm(" str w0, [sp, 1092]\n");
asm(" ldr w0, [sp, 1092]\n");
asm(" cmn w0, #1\n");
asm(" bne .L5\n");
asm(" adrp x0, .LC4\n");
asm(" add x0, x0, :lo12:.LC4\n");
asm(" bl perror\n");
asm(" bl __errno\n");
asm(" ldr w0, [x0]\n");
asm(" b .L9\n");
asm(".L5:\n");
asm(" add x0, sp, 32\n");
asm(" mov x2, 16\n");
asm(" mov w1, 0\n");
asm(" bl memset\n");
asm(" mov w0, 2\n");
asm(" strh w0, [sp, 32]\n");
asm(" ldr w0, [sp, 1116]\n");
asm(" and w0, w0, 65535\n");
asm(" rev16 w0, w0\n");
asm(" and w0, w0, 65535\n");
asm(" strh w0, [sp, 34]\n");
asm(" ldr x0, [sp, 16]\n");
asm(" add x0, x0, 8\n");
asm(" ldr x0, [x0]\n");
asm(" bl gethostbyname\n");
asm(" str x0, [sp, 1080]\n");
asm(" ldr x0, [sp, 1080]\n");
asm(" ldr x0, [x0, 24]\n");
asm(" ldr x1, [x0]\n");
asm(" ldr x0, [sp, 1080]\n");
asm(" ldr w0, [x0, 20]\n");
asm(" sxtw x2, w0\n");
asm(" add x0, sp, 32\n");
asm(" add x0, x0, 4\n");
asm(" bl memcpy\n");
asm(" add x0, sp, 32\n");
asm(" mov w2, 16\n");
asm(" mov x1, x0\n");
asm(" ldr w0, [sp, 1092]\n");
asm(" bl connect\n");
asm(" str w0, [sp, 1076]\n");
asm(" ldr w0, [sp, 1076]\n");
asm(" cmn w0, #1\n");
asm(" bne .L6\n");
asm(" ldr w1, [sp, 1116]\n");
asm(" adrp x0, .LC5\n");
asm(" add x0, x0, :lo12:.LC5\n");
asm(" bl printf\n");
asm(" b .L7\n");
asm(".L6:\n");
asm(" ldr w1, [sp, 1116]\n");
asm(" adrp x0, .LC6\n");
asm(" add x0, x0, :lo12:.LC6\n");
asm(" bl printf\n");
asm(".L7:\n");
asm(" ldr w0, [sp, 1116]\n");
asm(" add w0, w0, 1\n");
asm(" str w0, [sp, 1116]\n");
asm(" b .L8\n");
asm(".L4:\n");
asm(" mov w0, 0\n");
asm(".L9:\n");
asm(" ldp x29, x30, [sp]\n");
asm(" add sp, sp, 1120\n");
asm(" .cfi_restore 29\n");
asm(" .cfi_restore 30\n");
asm(" .cfi_def_cfa_offset 0\n");
asm(" ret\n");
asm(" .cfi_endproc\n");
asm(".LFE19:\n");
asm(" .size main, .-main\n");
asm("\n");
/*
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdlib.h>
#include <errno.h>
int main(int argc, char **argv)
{
int sd; //socket descriptor
int port; //port number
int start; //start port
int end; //end port
int rval; //socket descriptor for connect
char responce[2024]; //to receive data
const char *message="shell"; //data to send
struct hostent *hostaddr; //To be used for IPaddress
struct sockaddr_in servaddr; //socket structure
if (argc < 4 )
{
printf("------Created By www.h4ck-y0u.org-----------\n");
printf("--------------------------------------------------\n");
printf("Usage: ./tscan <IPaddress> <Start Port> <End Port>\n");
printf("--------------------------------------------------\n");
return (EINVAL);
}
start = atoi(argv[2]);
end = atoi(argv[3]);
for (port=start; port<=end; port++)
{
//portno is ascii to int second argument
sd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); //created the tcp socket
if (sd == -1)
{
perror("Socket()\n");
return (errno);
}
memset( &servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(port); //set the portno
hostaddr = gethostbyname( argv[1] ); //get the ip 1st argument
memcpy(&servaddr.sin_addr, hostaddr->h_addr, hostaddr->h_length);
//below connects to the specified ip in hostaddr
rval = connect(sd, (struct sockaddr *) &servaddr, sizeof(servaddr));
if (rval == -1)
{
printf("Port %d is closed\n", port);
// close(sd);
}
else
printf("Port %d is open\n",port);
// close(sd); //socket descriptor
}
}
*/
No comments:
Post a Comment