| 726 | | if ( isPortListening(ntohs(tcp->th_dport),*(uint32_t *)&(ip->ip_dst)) == false ) |
|---|
| 727 | | { |
|---|
| 728 | | logInfo("Connection to unbound port %i requested, binding port\n",ntohs(tcp->th_dport)); |
|---|
| 729 | | |
|---|
| 730 | | Socket *sock = g_Nepenthes->getSocketMgr()->bindTCPSocket(INADDR_ANY,ntohs(tcp->th_dport),60,60); |
|---|
| 731 | | if ( sock != NULL ) |
|---|
| 732 | | { |
|---|
| 733 | | |
|---|
| 734 | | DialogueFactory *diaf; |
|---|
| 735 | | if ( (diaf = g_Nepenthes->getFactoryMgr()->getFactory("WinNTShell DialogueFactory")) == NULL ) |
|---|
| 736 | | { |
|---|
| 737 | | logCrit("No WinNTShell DialogueFactory availible \n"); |
|---|
| 738 | | return 1; |
|---|
| 739 | | } |
|---|
| 740 | | |
|---|
| 741 | | sock->addDialogueFactory(diaf); |
|---|
| 742 | | } |
|---|
| 743 | | } |
|---|
| | 718 | if (1) // isPortListening(ntohs(tcp->th_dport),*(uint32_t *)&(ip->ip_dst)) == false ) |
|---|
| | 719 | /* |
|---|
| | 720 | * FreeBSD got no /proc/net/tcp and the code to retrieve the data from the kvm or sys*whatever* is pretty cruel |
|---|
| | 721 | * http://cvsup.pt.freebsd.org/cgi-bin/cvsweb/cvsweb.cgi/src/usr.bin/systat/netstat.c?rev=1.25&content-type=text/x-cvsweb-markup |
|---|
| | 722 | * I hope to replace this someday with a real check, to avoid all the crit warnings when trying to bind a already bound port |
|---|
| | 723 | */ |
|---|
| | 724 | { |
|---|
| | 725 | // logInfo("Connection to unbound port %i requested, binding port\n",ntohs(tcp->th_dport)); |
|---|
| | 726 | |
|---|
| | 727 | Socket *sock = g_Nepenthes->getSocketMgr()->bindTCPSocket(INADDR_ANY,ntohs(tcp->th_dport),60,60); |
|---|
| | 728 | if ( sock != NULL && (sock->getDialogst()->size() == 0 && sock->getFactories()->size() == 0) ) |
|---|
| | 729 | { |
|---|
| | 730 | |
|---|
| | 731 | DialogueFactory *diaf; |
|---|
| | 732 | if ( (diaf = g_Nepenthes->getFactoryMgr()->getFactory("WinNTShell DialogueFactory")) == NULL ) |
|---|
| | 733 | { |
|---|
| | 734 | logCrit("No WinNTShell DialogueFactory availible \n"); |
|---|
| | 735 | return 1; |
|---|
| | 736 | } |
|---|
| | 737 | |
|---|
| | 738 | sock->addDialogueFactory(diaf); |
|---|
| | 739 | } |
|---|
| | 740 | } |
|---|