Simple Honeypot server based on Wiznet W7500, support 7 different sockets

Dependencies:   HoneyPot SDFileSystem WIZnetInterface mbed-src

Fork of W7500-honeypot by Shlomi Ruder

Honeypot Server Example w7500 Wiznet

/media/uploads/proxytype/honeypot.png

Simple example of Honeypot server for detecting unwanted network behaviors over the network and report it to the administrator, for example, when the attacker scan the network and try to detect all the machines and services.

the honeypot is the dark corner of the network, is a place that nobody should visit and if some one does, it's not for legitimate reasons.

Configuration

first setup is define the honeypot server and the master address that will be access to administrator panel,

//honeypot address - static
char ip_addr[] = "192.168.1.111";

//master address - static
char master_addr[] = "192.168.1.6";

char subnet_mask[] = "255.255.255.0";
char gateway_addr[] = "192.168.1.1";

copy the html files inside html folder directly to root folder of the SD card.

Sockets

we can define up to 7 different ports (sockets) for detecting,

  int  ports[7] = {80, 22, 138, 21, 23, 35, 3306};
    
    
    if (!svr.start(ports, 7, master_addr, &eth)) {

        printf("Server not starting !");
        exit(0);
    }
    
    while(1) {
        svr.poll();
    }

Http Response

there is two different modes when setting socket on port 80, one for ordinary users and another for the master of the device.

Visitor

/media/uploads/proxytype/visitor.png

Master

/media/uploads/proxytype/administrator_panel.jpg

Committer:
proxytype
Date:
Sun Sep 03 14:44:19 2017 +0000
Revision:
2:2c1e0056bb9d
Parent:
0:4b69bf32fe08

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
proxytype 0:4b69bf32fe08 1 #include "mbed.h"
proxytype 0:4b69bf32fe08 2 #include "EthernetInterface.h"
proxytype 0:4b69bf32fe08 3 #include "FsHandler.h"
proxytype 0:4b69bf32fe08 4 #include "HoneypotServer.h"
proxytype 0:4b69bf32fe08 5 #include "SDFileSystem.h"
proxytype 0:4b69bf32fe08 6
proxytype 0:4b69bf32fe08 7 #ifdef TARGET_WIZWIKI_W7500
proxytype 0:4b69bf32fe08 8 //Choose one of file system.
proxytype 0:4b69bf32fe08 9 SDFileSystem local(SD_MOSI, SD_MISO, SD_CLK, SD_SEL, "local");//PB_3, PB_2, PB_1, PB_0
proxytype 0:4b69bf32fe08 10 //LocalFileSystem local("local");
proxytype 0:4b69bf32fe08 11 #endif
proxytype 0:4b69bf32fe08 12
proxytype 0:4b69bf32fe08 13 #ifdef TARGET_WIZWIKI_W7500
proxytype 0:4b69bf32fe08 14 uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x01, 0x02};
proxytype 0:4b69bf32fe08 15 #endif
proxytype 0:4b69bf32fe08 16
proxytype 0:4b69bf32fe08 17 EthernetInterface eth;
proxytype 0:4b69bf32fe08 18 HoneypotServer svr;
proxytype 0:4b69bf32fe08 19
proxytype 0:4b69bf32fe08 20
proxytype 0:4b69bf32fe08 21
proxytype 0:4b69bf32fe08 22 char ip_addr[] = "192.168.1.111";
proxytype 2:2c1e0056bb9d 23 char master_addr[] = "192.168.1.7";
proxytype 0:4b69bf32fe08 24 char subnet_mask[] = "255.255.255.0";
proxytype 0:4b69bf32fe08 25 char gateway_addr[] = "192.168.1.1";
proxytype 0:4b69bf32fe08 26
proxytype 0:4b69bf32fe08 27 //#define DHCP //If uncomment, W7500 runs DHCP
proxytype 0:4b69bf32fe08 28
proxytype 0:4b69bf32fe08 29 int main()
proxytype 0:4b69bf32fe08 30 {
proxytype 0:4b69bf32fe08 31 HTTPFsRequestHandler::mount("/local/", "/");
proxytype 0:4b69bf32fe08 32 svr.addHandler<HTTPFsRequestHandler>("/");
proxytype 0:4b69bf32fe08 33
proxytype 0:4b69bf32fe08 34 #ifdef TARGET_WIZWIKI_W7500
proxytype 0:4b69bf32fe08 35
proxytype 0:4b69bf32fe08 36 #ifdef DHCP
proxytype 0:4b69bf32fe08 37 eth.init(mac_addr); //Use DHCP
proxytype 0:4b69bf32fe08 38 #else
proxytype 0:4b69bf32fe08 39 eth.init(mac_addr, ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
proxytype 0:4b69bf32fe08 40 #endif
proxytype 0:4b69bf32fe08 41
proxytype 0:4b69bf32fe08 42 #else
proxytype 0:4b69bf32fe08 43
proxytype 0:4b69bf32fe08 44 #ifdef DHCP
proxytype 0:4b69bf32fe08 45 eth.init(); //Use DHCP
proxytype 0:4b69bf32fe08 46 #else
proxytype 0:4b69bf32fe08 47 eth.init(ip_addr, subnet_mask, gateway_addr); //Not Use DHCP
proxytype 0:4b69bf32fe08 48 #endif
proxytype 0:4b69bf32fe08 49
proxytype 0:4b69bf32fe08 50 #endif
proxytype 0:4b69bf32fe08 51
proxytype 0:4b69bf32fe08 52 printf("Check Ethernet Link\r\n");
proxytype 0:4b69bf32fe08 53 while(1) { //Wait link up
proxytype 0:4b69bf32fe08 54 if(eth.link() == true)
proxytype 0:4b69bf32fe08 55 break;
proxytype 0:4b69bf32fe08 56 }
proxytype 0:4b69bf32fe08 57 printf("Link up\r\n");
proxytype 0:4b69bf32fe08 58
proxytype 0:4b69bf32fe08 59 eth.connect();
proxytype 0:4b69bf32fe08 60
proxytype 0:4b69bf32fe08 61 printf("Server IP Address is %s\r\n", eth.getIPAddress());
proxytype 0:4b69bf32fe08 62
proxytype 0:4b69bf32fe08 63 int ports[6] = {80, 22, 138, 21, 23, 35};
proxytype 0:4b69bf32fe08 64
proxytype 0:4b69bf32fe08 65
proxytype 0:4b69bf32fe08 66 if (!svr.start(ports, 6, master_addr, &eth)) {
proxytype 0:4b69bf32fe08 67
proxytype 0:4b69bf32fe08 68 printf("Server not starting !");
proxytype 0:4b69bf32fe08 69 exit(0);
proxytype 0:4b69bf32fe08 70 }
proxytype 0:4b69bf32fe08 71
proxytype 0:4b69bf32fe08 72 while(1) {
proxytype 0:4b69bf32fe08 73 svr.poll();
proxytype 0:4b69bf32fe08 74 }
proxytype 0:4b69bf32fe08 75
proxytype 0:4b69bf32fe08 76 }
proxytype 0:4b69bf32fe08 77