Ejemplo n.º 1
0
int _tmain(int argc, _TCHAR* argv[])
{
	HMODULE hook = LoadLibraryA("CaptureAdapterHook.dll");
	
	RUN_CAPTURE run_capture = (RUN_CAPTURE)GetProcAddress(hook, "RunCapture");

	run_capture();

	Sleep(5000);

	return 0;
}
Ejemplo n.º 2
0
static int ssh_open_remote_connection(const char* hostname, const unsigned int port, const char* username, const char* password,
	const char* sshkey, const char* sshkey_passphrase, const char* iface, const char* cfilter,
	const guint32 count, const char* fifo)
{
	ssh_session sshs;
	ssh_channel channel;
	FILE* fp = stdout;
	guint64 bytes_written = 0;
	int err;
	int ret = EXIT_FAILURE;
	char* err_info = NULL;

	if (g_strcmp0(fifo, "-")) {
		/* Open or create the output file */
		fp = fopen(fifo, "w");
		if (!fp) {
			g_warning("Error creating output file: %s", g_strerror(errno));
			return EXIT_FAILURE;
		}
	}

	sshs = create_ssh_connection(hostname, port, username, password, sshkey, sshkey_passphrase, &err_info);
	if (!sshs) {
		g_warning("Error creating connection: %s", err_info);
		goto cleanup;
	}

	if (!libpcap_write_file_header(fp, 1, PCAP_SNAPLEN, FALSE, &bytes_written, &err)) {
		g_warning("Can't write pcap file header");
		goto cleanup;
	}

	channel = run_capture(sshs, iface, cfilter, count);
	if (!channel) {
		ret = EXIT_FAILURE;
		goto cleanup;
	}

	/* read from channel and write into fp */
	ssh_loop_read(channel, fp, count);

	/* clean up and exit */
	ciscodump_cleanup(sshs, channel, iface, cfilter);

	ret = EXIT_SUCCESS;
cleanup:
	if (fp != stdout)
		fclose(fp);

	return ret;
}
Ejemplo n.º 3
0
int main(int argc, char *argv[])
{
	const char *basename = "test";
	float delay = 0.0;
	bool testonly = false;
	int opt;

	while ((opt = getopt(argc, argv, "d:b:th")) != -1) {
		switch (opt) {
		case 'd':
			delay = atof(optarg);
			break;
		case 'b':
			basename = optarg;
			break;
		case 'l':
			led_path = optarg;
			break;
		case 't':
			testonly = true;
			break;
		case 'h':
			usage();
			exit(0);
			break;
		default:
			printf("Invalid option '%c'\n", opt);
			usage();
			exit(1);
		}
	}

	argv += optind;
	argc -= optind;

	while (true) {
		printf("Starting capture\n");
		run_capture(basename, delay, testonly);
	}
	return 0;
}