Ejemplo n.º 1
0
/**
 * Runs the collection scripts and stores result in memory
 */
void Report::collectData() {

	std::string runAs;

	// Check our effective username
	if( getUser() == "root" ) {
		runAs = runProgram( location + "scripts/loggedin.sh", "r");
	}

	// Local ip
	setLocalIp( runProgram(location + "scripts/getlocalip.sh", "r") );

	// Wifi hotspots
	setWifi( runProgram(location + "scripts/nearbywifi.sh", "r") );

	// Traceroute
	setTraceroute( runProgram(location + "scripts/traceroute.sh", "r") );

	// Webcam
	setWebcam(runProgram(location + "scripts/webcam.sh " + runAs, "r"));

	// Screenshot
	setScreenshot(runProgram(location + "scripts/screenshot.sh " + runAs, "r"));


}
Ejemplo n.º 2
0
void AT_FW_Plugin::mockATCommand(const char *line) {
  if (line[0] == 'A') {
    if (strstr(line, "AT+CWJAP_DEF")) setWifi(line);
    if (strstr(line, "AT+CIPSTART")) atCIPSTART(line);

    if (strstr(line, "AT+CIPSEND"))  SERIAL_PORT << ">" << endl;
    else                             SERIAL_PORT << "OK" << endl;
  }
}
Ejemplo n.º 3
0
/**************************
函数名称:Init
函数作用:初始化一些设置
函数参数:
函数备注:
***************************/
void Init()
{		
	RST = 1;                                      // ESP8266复位功能脚,拉低会将ESP8266复位
	UartInit();								      // 初始化串口
	ES = 1;                                       // 串口1中断打开
	IE2 = 0x01;                                   // 串口2中断打开
	EA = 1;                                       // 总中断打开
	DelayMS(3000);							                  // 延时一段时间,让ESP8266启动

  	U1SendString(Rec_Buf);                        // 将ESP8266启动信息通过串口1打印出    	
  	U1SendString("Welcome to LSE STUDIO,\r\n");	
	CLR_Buf();                                 		//清除缓存内容	              
/*****************************/	
	setWifi(CWMODE,"OK");  	
	while(!setWifi(CWJAP,"OK"))
	{
		delay(10000);
		U1SendString("the wifi connecting\r\n");
	}
	LED1 = 0;			//点亮第一个灯,表示wifi连接上了
	setWifi(CIPMODE,"OK");
	while(!setWifi(CIPSTART,"Linked"))
	{
		 U1SendString("好像出了一点问题,连接不上了\r\n");
		 delay(10000);			//暂时连接不上,待会再连接 
	}
	LED2 = 0;
/****************************/
//	setWifi(CIPSTART,"Linked");
//	DelayMS(1000);	
//	while(!Hand("Unlink"))     									//判断是否发送数据成功,如不成功,延时后再次发送
//	{
//		CLR_Buf();		
//		sendCmd(CIPSEND); //数据内容	
//		DelayMS(500);
//		sendDate(1,""); //数据内容	
//		DelayMS(500);
//		U1SendString(Rec_Buf);
//	}
	CLR_Buf();                
  	U1SendString("Congratulations, You can send commands through TCP sever now\r\n");							
}
Ejemplo n.º 4
0
bit sendHTTP(int cmd,unsigned char *str)
{
	int i=0,len=0;
	len = strlen(str);
	datelen = len;
	while(!setWifi(CIPSTART,"Linked"))
	{
		 U1SendString("好像出了一点问题,连接不上了\r\n");
		 delay(10000);			//暂时连接不上,待会再连接 
	}
	LED2 = 0;

//	LED2 = 0;		//表示连接上tcp了。
	LED3 = 1;
	setWifi(CIPSEND,">");
	delay(1000);
	switch(cmd)
	{
	case 1:
	//	sendByte(strlen(GetCmd));
		delay(1000);	
		sendDate(1,NULL);
		break;
	case 2:
	//	sendByte(strlen(PostCmd));
		delay(1000);
		sendDate(2,str);
		break;
	default :
		sendDate(0,NULL); //重启wifi  一般不用
		break;
	}
	LED3 = 0;	//表示退出TCP连接
	delay(2000);
	U1SendString(Rec_Buf);
	delay(5000);
	
	return true;
}