代理协议实现源代码解析
admin | net work | 2013-10-11
C++
能够支持Socks4,Socks5代理协议;Socks5支持所有的三种方法(CONNECT,BIND,UDP),支持身份认证;支持HTTP代理协议,包括GET和CONNECT方法,还支持FTP的WEB下载请求。仅供参考,欢迎讨论。
头文件 //=========================================================================
/* 文件: Socks.h */
/* 说明: 代... [阅读全文]
using c-ares and libcurl
admin | net work | 2013-09-26
C++
#include
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include
#include <string.h>
#include <assert.h>
#define ERROR_EXIT(x...) do {fprintf(stderr, x);fprintf(stderr, ", %s:%d", __FILE__, __LINE__);exit(-1);}while(0)
#define DEBUG(x...) do {fp... [阅读全文]
Get IP by Hostname
admin | net work | 2013-04-04
C++
#include<stdio.h>
#include<stdlib.h>
#include<netdb.h>
#include<arpa/inet.h>
int main(int argc, char **argv) {
struct hostent *host;
char str[100];
char addr[INET_ADDRSTRLEN];
char **p;
int c;
while (1){
c=0;
gets(str);
printf("%s\n",str);
if ... [阅读全文]
ip地址正则表达式测试是否正确
admin | net work | 2013-04-04
C++
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char *test;
/*
int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t nmatch,
... [阅读全文]
raw socket 发送阻断包
admin | net work | 2013-04-04
C++
来源:http://bugkill.01safe.com/thread-207-1-1.html
*int sndpkt_tcp_rst(u32 seq,u32 src_ip, u32 dst_ip, u16 src_prt, u16 dst_prt)
{
static int i=0;
int one=1; /* R.Stevens says we need this variable for the setsockopt call */
int tcphdrlen = sizeof(struct tcphdr);
int iphdrlen = sizeof(str... [阅读全文]
raw socket 发送阻断包
admin | net work | 2013-04-04
C++
来源:http://bugkill.01safe.com/thread-207-1-1.html
*int sndpkt_tcp_rst(u32 seq,u32 src_ip, u32 dst_ip, u16 src_prt, u16 dst_prt)
{
static int i=0;
int one=1; /* R.Stevens says we need this variable for the setsockopt call */
int tcphdrlen = sizeof(struct tcphdr);
int iphdrlen = sizeof(str... [阅读全文]
获取本地主机ipv4地址和ipv6地址
admin | net work | 2013-04-04
C++
#include <Winsock2.h>
#include <stdio.h>
#include <iostream>
#include <cstring>
#include<ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib ") //linking to the library
using namespace std;
int get_ip()
{
struct addrinfo *ailist, *aip;
struct addrinfo hin... [阅读全文]
json数据分析http网页抓取
admin | net work | 2013-04-04
主要是对一些通用功能的简单封装,包括:
json数据分析类
文件访问类,
htttp链接类(支持异步链接,一句代码即可抓取一个网页)
线程池类,
任务类
正则表达式类,主要是对开源的pcre的封装
字符串类,嵌入正则表达式支持
……
源码链接地址:
https://github.com/qqjack/MyLibOfMySelf
欢迎修改,完善,添加新通用功能。。谢谢
C++
... [阅读全文]
Windows管道技术简述
admin | net work | 2013-03-15
不知你是否用过这样的程序,他们本身并没有解压缩的功能,而是调用DOS程序PKZIP完成ZIP包的解压缩。但是在程序运行时又没有DOS控制台的窗口出现而且一切本应该在DOS下显示的信息都出现在了那个安装程序的一个文本框里。这种设计既美观又可以防止少数眼疾手快的用户提前关了你的DOS窗口。 现在就来讨论一下,如何用匿名管道技术实现这个功能。
管道技术... [阅读全文]