-
February 12th, 2006, 01:32 PM
#1
Junior Member
my tiny scanner
hi whats up ??
before 2 days ago i was so board so i started to write a port scanner her it is :
Code:
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char *argv[])
{
int sockfd, port;
struct hostent *host;
printf("welcome to Fast-scanner 1.4 \n");
if (argc != 2) {
fprintf(stderr,"ip or hostname\n");
exit(1);
}
if ((host=gethostbyname(argv[1])) == NULL) {
perror("gproblem finding victim :(");
exit(1);
}
for(port=0; port<=65000; port++)
{
struct sockaddr_in host_addr;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("problem in socket");
exit(1);
}
host_addr.sin_family = AF_INET;
host_addr.sin_port = htons(port);
host_addr.sin_addr = *((struct in_addr *)host->h_addr);
memset(&(host_addr.sin_zero), '\0', 8);
if (connect(sockfd, (struct sockaddr *)&host_addr, sizeof(struct sockaddr)) == -1) {
//printf(".");
close(sockfd);
}
else {
printf("*****this port %i is open*****\n", port);
close(sockfd);
}
}
printf("for more info on port numbers :http://www.iana.org/assignments/port-numbers\n");
printf("Mr-Unix Tm Mr.uN1x.sec@gmail.com \n");
}
tell me what you think about my scanner and what to improve
tnx
-
February 12th, 2006, 04:17 PM
#2
Member
There is nothing to say much about your scanner. It is a simple, common port scanner. Actualy all port scanners are the same. But it is an idea, you can start adding stuff and features and it will probably become a famous security scanner.
Good luck in your projects!
The access to the computer or
anything else that shows us how the
world works must be total and
unlimited.
-
February 12th, 2006, 07:13 PM
#3
The forum inserted a smiley into your code, but it compiles and runs.
Scan a nonexistant host and it hangs.
Code:
rcgreen@blue:~/prog/c$ ./ascan 192.168.1.3
welcome to Fast-scanner 1.4
Tcpdump shows that it was making an arp request.
Code:
12:56:44.445160 arp who-has genius.localdomain tell blue.localdomain
12:56:45.445160 arp who-has genius.localdomain tell blue.localdomain
12:56:46.445229 arp who-has genius.localdomain tell blue.localdomain
12:56:47.445160 arp who-has genius.localdomain tell blue.localdomain
12:56:48.445160 arp who-has genius.localdomain tell blue.localdomain
12:56:49.445185 arp who-has genius.localdomain tell blue.localdomain
12:56:50.445160 arp who-has genius.localdomain tell blue.localdomain
12:56:51.445160 arp who-has genius.localdomain tell blue.localdomain
12:56:52.445181 arp who-has genius.localdomain tell blue.localdomain
I came in to the world with nothing. I still have most of it.
-
February 12th, 2006, 08:49 PM
#4
Member
Ofcourse it is doing an arp request, you are in a network and scanning the internal network IP adress.
The access to the computer or
anything else that shows us how the
world works must be total and
unlimited.
-
February 12th, 2006, 09:27 PM
#5
Ofcourse it is doing an arp request
I mean, that, because the host was down, the program hangs.
It needs to time out and exit with an error message,
to be more polished.
I came in to the world with nothing. I still have most of it.
-
February 12th, 2006, 09:49 PM
#6
Junior Member
tnx on your replys i will fix the scanner and upload the scanner again
tnx
-
February 12th, 2006, 09:59 PM
#7
http://www.antionline.com/showthread...hreadid=268776
This one only does TCP, but it's a start as well.
The lisence is open, I found it on a Perl web site and started changing a few things to help me learn Perl.
-
February 12th, 2006, 11:34 PM
#8
this is what we need more of, new users that are willing to give instead of just taking with lame-ass questions. not that we dont all learn from question but...ahh you know what i mean.
thanks mr-unix! stick around.
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
-
February 13th, 2006, 12:05 AM
#9
Thanks mr-unix for that! Admittedly, I'll be sticking to nmap for quite a while - but I hope you keep this project going! Instead of reinventing the wheel though, maybe you could incorporte what you've already written into a different, more unique app. That'd be cool.
Cheers,
-jk
-
February 13th, 2006, 12:22 AM
#10
Junior Member
dont worry i will stick around.
tnx for your love ppl
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|