コード例 #1
0
ファイル: MainScreen.cpp プロジェクト: ChaosMarc/PlugY
void Install_PrintPlugYVersion()
{
	static int isInstalled = false;
	if (isInstalled) return;

	log_msg("Patch D2Launch to print PlugY version. (PrintPlugYVersion)\n");

	// Print PlugY version.
	mem_seek R7(D2Launch, 7F5D, 7F7D, 9639, 117C7, 178A7, 16AF7, 18061, 10A11);
	MEMJ_REF4( D2CreateTextBox, caller_printPlugYVersion);
	//6FA19638  |. E8 1BED0000    CALL <JMP.&D2Win.#10017>
	//6FA517C6  |. E8 6F81FFFF    CALL <JMP.&D2Win.#10147>
	//6FA578A6  |. E8 D71FFFFF    CALL <JMP.&D2Win.#10113>
	//6FA56B1F  |. E8 1A2EFFFF    CALL <JMP.&D2Win.#10098>
	//6FA56AF6  |. E8 432EFFFF    CALL <JMP.&D2Win.#10098>
	//6FA58060  |. E8 ED18FFFF    CALL <JMP.&D2Win.#10098>
	//6FA50A10  |. E8 218FFFFF    CALL <JMP.&D2Win.#10164>


	log_msg("\n");

	isInstalled = true;
}
コード例 #2
0
ファイル: flow-tool.c プロジェクト: nathanmkaya/ksh-arch
static int
ftfread(register Dssfile_t* file, register Dssrecord_t* record, Dssdisc_t* disc)
{
	register State_t*	state = (State_t*)file->data;
	register Netflow_t*	rp = &state->record;
	register char*		fp;
	size_t			n;
	Nftime_t		boot;

	while (!state->count--)
	{
		if (state->data = (char*)sfreserve(file->io, state->chunk * state->size, 0))
		{
			state->count = state->chunk;
			break;
		}
		if (!(n = sfvalue(file->io)))
			return 0;
		if (!(state->chunk = n / state->size))
		{
			if (disc->errorf)
				(*disc->errorf)(NiL, disc, 2, "%slast packet incomplete", cxlocation(file->dss->cx, record));
			return -1;
		}
		state->count = 0;
	}
	memset(rp, 0, sizeof(*rp));
	rp->set = NETFLOW_SET_src_addrv4|NETFLOW_SET_dst_addrv4|NETFLOW_SET_hopv4;
	fp = state->data;
	state->data += state->size;
	switch (state->version)
	{
	case 1:
		if (n = state->swap & 3)
		{
			swapmem(n, &R1(fp)->unix_secs, &R1(fp)->unix_secs, (char*)&R1(fp)->input - (char*)&R1(fp)->unix_secs);
			swapmem(n, &R1(fp)->dPkts, &R1(fp)->dPkts, (char*)&R1(fp)->srcport - (char*)&R1(fp)->dPkts);
			if (n &= 1)
			{
				swapmem(n, &R1(fp)->input, &R1(fp)->input, (char*)&R1(fp)->dPkts - (char*)&R1(fp)->input);
				swapmem(n, &R1(fp)->srcport, &R1(fp)->srcport, (char*)&R1(fp)->prot - (char*)&R1(fp)->srcport);
			}
		}
		rp->src_addrv4 = R1(fp)->srcaddr;
		rp->dst_addrv4 = R1(fp)->dstaddr;
		rp->hopv4 = R1(fp)->nexthop;
		rp->input = R1(fp)->input;
		rp->output = R1(fp)->output;
		rp->packets = R1(fp)->dPkts;
		rp->bytes = R1(fp)->dOctets;
		rp->first = R1(fp)->First;
		rp->last = R1(fp)->Last;
		rp->src_port = R1(fp)->srcport;
		rp->dst_port = R1(fp)->dstport;
		rp->flags = 0;
		rp->tcp_flags = R1(fp)->tcp_flags;
		rp->protocol = R1(fp)->prot;
		rp->src_tos = R1(fp)->tos;
		rp->time = R1(fp)->unix_secs;
		rp->nsec = R1(fp)->unix_nsecs;
		rp->uptime = R1(fp)->sysUpTime;
		break;
	case 5:
		if (n = state->swap & 3)
		{
			swapmem(n, &R5(fp)->unix_secs, &R5(fp)->unix_secs, (char*)&R5(fp)->input - (char*)&R5(fp)->unix_secs);
			swapmem(n, &R5(fp)->dPkts, &R5(fp)->dPkts, (char*)&R5(fp)->srcport - (char*)&R5(fp)->dPkts);
			if (n &= 1)
			{
				swapmem(n, &R5(fp)->input, &R5(fp)->input, (char*)&R5(fp)->dPkts - (char*)&R5(fp)->input);
				swapmem(n, &R5(fp)->srcport, &R5(fp)->srcport, (char*)&R5(fp)->prot - (char*)&R5(fp)->srcport);
				swapmem(n, &R5(fp)->src_as, &R5(fp)->src_as, (char*)(R5(fp)+1) - (char*)&R5(fp)->src_as);
			}
		}
		rp->src_addrv4 = R5(fp)->srcaddr;
		rp->dst_addrv4 = R5(fp)->dstaddr;
		rp->hopv4 = R5(fp)->nexthop;
		rp->input = R5(fp)->input;
		rp->output = R5(fp)->output;
		rp->packets = R5(fp)->dPkts;
		rp->bytes = R5(fp)->dOctets;
		rp->first = R5(fp)->First;
		rp->last = R5(fp)->Last;
		rp->src_port = R5(fp)->srcport;
		rp->dst_port = R5(fp)->dstport;
		rp->flags = 0;
		rp->tcp_flags = R5(fp)->tcp_flags;
		rp->protocol = R5(fp)->prot;
		rp->src_tos = R5(fp)->tos;
		rp->engine_type = R5(fp)->engine_type;
		rp->engine_id = R5(fp)->engine_id;
		rp->src_as16 = R5(fp)->src_as;
		rp->dst_as16 = R5(fp)->dst_as;
		rp->src_maskv4 = R5(fp)->src_mask;
		rp->dst_maskv4 = R5(fp)->dst_mask;
		rp->time = R5(fp)->unix_secs;
		rp->nsec = R5(fp)->unix_nsecs;
		rp->uptime = R5(fp)->sysUpTime;
		break;
	case 6:
		if (n = state->swap & 3)
		{
			swapmem(n, &R6(fp)->unix_secs, &R6(fp)->unix_secs, (char*)&R6(fp)->input - (char*)&R6(fp)->unix_secs);
			swapmem(n, &R6(fp)->dPkts, &R6(fp)->dPkts, (char*)&R6(fp)->srcport - (char*)&R6(fp)->dPkts);
			if (n &= 1)
			{
				swapmem(n, &R6(fp)->input, &R6(fp)->input, (char*)&R6(fp)->dPkts - (char*)&R6(fp)->input);
				swapmem(n, &R6(fp)->srcport, &R6(fp)->srcport, (char*)&R6(fp)->prot - (char*)&R6(fp)->srcport);
				swapmem(n, &R6(fp)->src_as, &R6(fp)->src_as, (char*)(R6(fp)+1) - (char*)&R6(fp)->src_as);
			}
		}
		rp->src_addrv4 = R6(fp)->srcaddr;
		rp->dst_addrv4 = R6(fp)->dstaddr;
		rp->hopv4 = R6(fp)->nexthop;
		rp->input = R6(fp)->input;
		rp->output = R6(fp)->output;
		rp->packets = R6(fp)->dPkts;
		rp->bytes = R6(fp)->dOctets;
		rp->first = R6(fp)->First;
		rp->last = R6(fp)->Last;
		rp->src_port = R6(fp)->srcport;
		rp->dst_port = R6(fp)->dstport;
		rp->flags = 0;
		rp->tcp_flags = R6(fp)->tcp_flags;
		rp->protocol = R6(fp)->prot;
		rp->src_tos = R6(fp)->tos;
		rp->engine_type = R6(fp)->engine_type;
		rp->engine_id = R6(fp)->engine_id;
		rp->src_as16 = R6(fp)->src_as;
		rp->dst_as16 = R6(fp)->dst_as;
		rp->src_maskv4 = R6(fp)->src_mask;
		rp->dst_maskv4 = R6(fp)->dst_mask;
		rp->time = R6(fp)->unix_secs;
		rp->nsec = R6(fp)->unix_nsecs;
		rp->uptime = R6(fp)->sysUpTime;
		break;
	case 7:
		if (n = state->swap & 3)
		{
			swapmem(n, &R7(fp)->unix_secs, &R7(fp)->unix_secs, (char*)&R7(fp)->input - (char*)&R7(fp)->unix_secs);
			swapmem(n, &R7(fp)->dPkts, &R7(fp)->dPkts, (char*)&R7(fp)->srcport - (char*)&R7(fp)->dPkts);
			if (n &= 1)
			{
				swapmem(n, &R7(fp)->input, &R7(fp)->input, (char*)&R7(fp)->dPkts - (char*)&R7(fp)->input);
				swapmem(n, &R7(fp)->srcport, &R7(fp)->srcport, (char*)&R7(fp)->prot - (char*)&R7(fp)->srcport);
				swapmem(n, &R7(fp)->src_as, &R7(fp)->src_as, (char*)(R7(fp)+1) - (char*)&R7(fp)->src_as);
			}
		}
		rp->src_addrv4 = R7(fp)->srcaddr;
		rp->dst_addrv4 = R7(fp)->dstaddr;
		rp->hopv4 = R7(fp)->nexthop;
		rp->input = R7(fp)->input;
		rp->output = R7(fp)->output;
		rp->packets = R7(fp)->dPkts;
		rp->bytes = R7(fp)->dOctets;
		rp->first = R7(fp)->First;
		rp->last = R7(fp)->Last;
		rp->src_port = R7(fp)->srcport;
		rp->dst_port = R7(fp)->dstport;
		rp->flags = 0;
		rp->tcp_flags = R7(fp)->tcp_flags;
		rp->protocol = R7(fp)->prot;
		rp->src_tos = R7(fp)->tos;
		rp->engine_type = R7(fp)->engine_type;
		rp->engine_id = R7(fp)->engine_id;
		rp->src_as16 = R7(fp)->src_as;
		rp->dst_as16 = R7(fp)->dst_as;
		rp->src_maskv4 = R7(fp)->src_mask;
		rp->dst_maskv4 = R7(fp)->dst_mask;
		rp->time = R7(fp)->unix_secs;
		rp->nsec = R7(fp)->unix_nsecs;
		rp->uptime = R7(fp)->sysUpTime;
		break;
	}
	boot = ((Nftime_t)rp->time * MS - (Nftime_t)rp->uptime) * US + (Nftime_t)rp->nsec;
	rp->start = boot + (Nftime_t)rp->first * US;
	rp->end = boot + (Nftime_t)rp->last * US;
	record->size = sizeof(*rp);
	record->data = rp;
	return 1;
}
コード例 #3
0
ファイル: FenPrincipale.cpp プロジェクト: jbfiot/rangers
FenPrincipale::FenPrincipale()
{	
	showMaximized();
	//showNormal();

	QMenu *menuFichier = menuBar()->addMenu("&Fichier");

	QAction *actionLoadImage = menuFichier->addAction("&Load Image");	
	actionLoadImage->setIcon(QIcon("Icons/fileopen.png"));
	menuFichier->addAction(actionLoadImage);

	QAction *actionExit = menuFichier->addAction("&Quitter");
	actionExit->setIcon(QIcon("Icons/fileclose.png"));
	menuFichier->addAction(actionExit);

	//QMenu *menuTools = menuBar()->addMenu("&Tools");

	QMenu *menuComm = menuBar()->addMenu("&Communication");

	QAction *actionSend = menuComm->addAction("&Send to server");	
	actionSend->setIcon(QIcon("Icons/ok.png"));

	// Création de la barre d'outils

    QToolBar *toolBarFichier = addToolBar("Fichier");
    toolBarFichier->addAction(actionLoadImage);
	toolBarFichier->addAction(actionExit);
	toolBarFichier->addSeparator();
	toolBarFichier->addAction(actionSend);
	
	QObject::connect(actionLoadImage, SIGNAL(triggered()), this, SLOT(LoadImageW()));
    QObject::connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
    QObject::connect(actionSend, SIGNAL(triggered()), this, SLOT(SendServer()));
	QObject::connect(actionSend, SIGNAL(triggered()), this, SLOT(ShowResults()));
    
	//
	// Création des docks
	//

	// dock IMAGE

	dockImage = new QDockWidget("Image", this);
	setCentralWidget(dockImage);

	ImageWidget = new QWidget;
	dockImage->setWidget(ImageWidget);

	// dock SERVEUR

	dockServeur = new QDockWidget("Serveur", this);
	addDockWidget(Qt::LeftDockWidgetArea, dockServeur);


	QWidget *paramDock = new QWidget;
	dockServeur->setWidget(paramDock);

	QSize s(220,20);

	adressServer1 = new QLineEdit(QString("138.195.102.25"));
	adressServer1->setMaximumSize(s);

	QHBoxLayout *adressLayout = new QHBoxLayout;
	adressLayout->addWidget(adressServer1);

	QWidget *adressWidget = new QWidget;
	adressWidget->setLayout(adressLayout);

	portAdressServer = new QLineEdit(QString("6006"));
	portAdressServer->setMaximumSize(s);

	QHBoxLayout *portLayout = new QHBoxLayout;
	portLayout->addWidget(portAdressServer);

	QWidget *portAdressWidget = new QWidget;
	portAdressWidget->setLayout(portLayout);

	QLabel *adressLabel = new QLabel("Adresse IP",paramDock);
	QLabel *portLabel = new QLabel("Port",paramDock);

	QPushButton *okServer = new QPushButton("Send");
	QObject::connect(okServer, SIGNAL(clicked()),this,SLOT(SendServer()));
	QObject::connect(okServer, SIGNAL(clicked()),this,SLOT(ShowResults()));

	QVBoxLayout *paramLayout = new QVBoxLayout(paramDock);
	paramLayout->addWidget(adressLabel);
	paramLayout->addWidget(adressWidget);
	paramLayout->addWidget(portLabel);
	paramLayout->addWidget(portAdressWidget);
	paramLayout->addWidget(okServer);
	paramLayout->setAlignment(Qt::AlignLeft);
	paramDock->setLayout(paramLayout);
	//dockServeur->setGeometry(QRect(100,200,200,250));
	dockServeur->setMaximumSize(250,200);

	// dock RESULTATS

	dockResults = new QDockWidget("Resultats",this);
	addDockWidget(Qt::RightDockWidgetArea, dockResults);
	dockResults->setMaximumWidth(250);

	WidgetResults = new QWidget;
	scrollArea = new QScrollArea;

	dockResults->setWidget(scrollArea);


	

	QPixmap *mini = new QPixmap(QString("test.jpg"));
	Result R(mini,98,"t");
	QPixmap *mini2 = new QPixmap(QString("9143.gif.jpg"));
	Result R2(mini2,95,"v");
	QPixmap *mini3 = new QPixmap(QString("test.jpg"));
	Result R3(mini3,92,"t");
	QPixmap *mini4 = new QPixmap(QString("test.jpg"));
	Result R4(mini4,90,"t");
	QPixmap *mini5 = new QPixmap(QString("test.jpg"));
	Result R5(mini5,88,"t");
	QPixmap *mini6 = new QPixmap(QString("test.jpg"));
	Result R6(mini6,86,"t");
	QPixmap *mini7 = new QPixmap(QString("test.jpg"));
	Result R7(mini7,84,"t");
	QPixmap *mini8 = new QPixmap(QString("test.jpg"));
	Result R8(mini8,82,"t");
	QPixmap *mini9 = new QPixmap(QString("test.jpg"));
	Result R9(mini9,81,"t");
	QPixmap *mini10 = new QPixmap(QString("test.jpg"));
	Result R10(mini10,79,"t");
	QPixmap *mini11 = new QPixmap(QString("test.jpg"));
	Result R11(mini11,78,"t");
	QPixmap *mini12 = new QPixmap(QString("test.jpg"));
	Result R12(mini12,77,"t");
	QPixmap *mini13 = new QPixmap(QString("test.jpg"));
	Result R13(mini13,76,"t");
	QPixmap *mini14 = new QPixmap(QString("test.jpg"));
	Result R14(mini14,75,"t");

	T.push_back(R);
	T.push_back(R2);
	T.push_back(R3);
	T.push_back(R4);
	T.push_back(R5);
	T.push_back(R6);
	T.push_back(R7);
	T.push_back(R8);
	T.push_back(R9);
	T.push_back(R10);
	T.push_back(R11);
	T.push_back(R12);
	T.push_back(R13);
	T.push_back(R14);

}