コード例 #1
0
bool PluginLocate::HttpRequestHandle(HTTPRequest & request)
{
	QString uri = request.GetURI();
	if (uri.startsWith("/vl/locate.jsp"))
	{
		QString serialnumber = request.GetArg("sn").remove(':');
		
		LogInfo(QString("Requesting LOCATE for tag %1").arg(serialnumber));
		
		if(GlobalSettings::Get("Config/StandAlone", true) == false)
		{
			// Forward request to Violet
			QByteArray violetAnswer = request.ForwardTo(GlobalSettings::GetString("DefaultVioletServers/BootServer"));

			// Analyse the answer to see if servers has changed
			QList<QByteArray> lines = violetAnswer.split('\n');
			foreach(QByteArray line, lines)
			{
				if (line.startsWith("ping")) 
				{}
				else if (line.startsWith("broad"))
				{}
				else if (line.startsWith("xmpp_domain"))
				{}
				else
					if (line.size() != 0)
						LogError(QString("Unknown locate server : ") + line);
			}
		}
コード例 #2
0
ファイル: plugin_rfid.cpp プロジェクト: stabilo/OpenJabNab
bool PluginRFID::HttpRequestHandle(HTTPRequest & request)
{
	QString uri = request.GetURI();
	if (uri.startsWith("/vl/rfid.jsp"))
	{
		QString serialnumber = request.GetArg("sn");
		QString tagId = request.GetArg("t");
		SetSettings("global/LastTag", tagId);

		Ztamp * z = ZtampManager::GetZtamp(this, tagId.toAscii());
		Bunny * b = BunnyManager::GetBunny(this, serialnumber.toAscii());
		b->SetPluginSetting(GetName(), "LastTag", tagId);
	
		if (z->OnRFID(b))
			return true;
		if (b->OnRFID(QByteArray::fromHex(tagId.toAscii())))
			return true;
	}
	return false;
}
コード例 #3
0
ファイル: plugin_auth.cpp プロジェクト: Laurent207/OpenJabNab
void PluginAuth::HttpRequestAfter(HTTPRequest & request)
{
	QString uri = request.GetURI();
	if (uri.startsWith("/vl/bc.jsp"))
	{
		QString version = request.GetArg("v");
		QString serialnumber = request.GetArg("m").remove(':');
		
		Bunny * b = BunnyManager::GetBunny(this, serialnumber.toAscii());
		if(b->GetBunnyPassword() == "" && GetSettings("global/authMethod", QString()).toString() == "patched")
		{
			LogDebug("Analyzing firmware for patch application");

			long address1 = 0x00011A4A;
			long address2 = 0x00011A91;
			long address3 = 0x00011AC9;
			long address4 = 0x00011AEB;

			int size1 = 3;
			int size2 = 6;
			int size3 = 6;
			int size4 = 1;

			QByteArray origin1;
			QByteArray origin2;
			QByteArray origin3;
			QByteArray origin4;

			QByteArray patch1;
			QByteArray patch2;
			QByteArray patch3;
			QByteArray patch4;

			origin1.append((char)0x02).append((char)0x3D).append((char)0x00);
			origin2.append((char)0x02).append((char)0x3D).append((char)0x00).append((char)0x02).append((char)0x3E).append((char)0x00);
			origin3.append((char)0x02).append((char)0x3D).append((char)0x00).append((char)0x02).append((char)0x3E).append((char)0x00);
			origin4.append((char)0x02);

			patch1.append((char)0x07).append((char)0x00).append((char)0x05);
			patch2.append((char)0x04).append((char)0x05).append((char)0x04).append((char)0x05).append((char)0x04).append((char)0x05);
			patch3.append((char)0x04).append((char)0x05).append((char)0x04).append((char)0x05).append((char)0x04).append((char)0x05);
			patch4.append((char)0x01);

			bool patch = true;
			if(request.reply.indexOf(origin1, address1) != address1)
			{
				LogDebug("Part 1 : KO");
				patch = false;
			}
			else
				LogDebug("Part 1 : OK");
			if(request.reply.indexOf(origin2, address2) != address2)
			{
				LogDebug("Part 2 : KO");
				patch = false;
			}
			else
				LogDebug("Part 2 : OK");
			if(request.reply.indexOf(origin3, address3) != address3)
			{
				LogDebug("Part 3 : KO");
				patch = false;
			}
			else
				LogDebug("Part 3 : OK");
			if(request.reply.indexOf(origin4, address4) != address4)
			{
				LogDebug("Part 4 : KO");
				patch = false;
			}
			else
				LogDebug("Part 4 : OK");
			if(patch)
			{
				LogDebug("Patching firmware");
				request.reply.replace(address1, size1, patch1);
				request.reply.replace(address2, size2, patch2);
				request.reply.replace(address3, size3, patch3);
				request.reply.replace(address4, size4, patch4);
			}
		}
	}
}