
网络/安全
zgl7903
iPad回帖太累人
展开
-
枚举和获取网卡物理MAC地址
int EnumHardWareMAC(){ HRESULT hrVal; HKEY pHKey = NULL; hrVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE//Microsoft//Windows NT//CurrentVersion//NetworkCards"), 0, KEY_A原创 2010-05-09 22:34:00 · 2342 阅读 · 0 评论 -
枚举HTML中的超链接
//IHTMLDocument2::links Propertyvoid EnumLinks(IHTMLDocument2 *phtmlDoc){ do { if(phtmlDoc == NULL) break; IHTMLElementCollection *p = NULL; if(FAILED(phtmlDoc->get_links(&p)原创 2013-12-12 05:38:37 · 1855 阅读 · 0 评论 -
HTTP页面下载(CInternetSession 和 CHttpFile应用)
//http下载DWORD HttpRead(LPCTSTR pstrURL, CString &szReturn){ DWORD dwError = 0; //初始化Socket do { if(!AfxSocketInit()) { dwError = ERROR_INTERNET_TCPIP_NOT_INSTALLED; AS原创 2013-12-21 12:04:25 · 2759 阅读 · 0 评论 -
URL编解码
//URL编码BSTR URLEncode(LPCSTR srcURL, UINT CodePage = CP_ACP){ BSTR bstrVal = NULL; int iWchLen=0, iUtf8Len=0, iEncLen = 0; wchar_t *wchBuff = NULL; char *utf8Buff = NULL; char *encURL = N原创 2015-06-18 05:56:01 · 1145 阅读 · 0 评论 -
SNTP 获取时间服务器UTC时间
// SntpTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include #include #pragma comment(lib, "wsock32.lib")//ref : www.ietf.org/rfc/rfc2030.txt原创 2015-05-25 15:05:47 · 3936 阅读 · 1 评论 -
Uinx 时间戳的转换
Unix时间戳(Unix timestamp), 定义为从格林威治时间1970年01月01日00时00分00秒起至现在的总秒数。原创 2017-10-14 16:47:53 · 1382 阅读 · 0 评论 -
查表法计算CRC32
#include <stdio.h>#include <stdlib.h>#include <string.h> typedef unsigned long u_int32_t;typedef unsigned char u_char; static const u_int32_t crc32tab[256] = { 0x00000000UL...原创 2018-04-15 10:20:07 · 3935 阅读 · 0 评论 -
枚举HTML元素及超链接
#include <mshtml.h>INT EnumHtmlElement(IDispatch *pDispDoc, CStringArray &m_listTags, CStringArray &m_listHref){ m_listTags.RemoveAll(); m_listHref.RemoveAll(); IHTMLDocument...原创 2018-11-14 09:56:05 · 3336 阅读 · 0 评论 -
IcmpSendEcho 实现 ping
#include <Winsock2.h>#pragma comment(lib, "Ws2_32.lib")#include <icmpapi.h>#pragma comment(lib, "Iphlpapi.lib")// Initialize Winsockstruct _tagWinSockInit_t{ _tagWinSockInit_...原创 2018-11-30 16:20:27 · 2254 阅读 · 0 评论 -
使用HTTP传输
使用HTTP传输 #include <afxinet.h> #include <afxsock.h> //http传输 DWORD HttpTranslate( int iRequstType, LPCTSTR pstrURL, LPCTSTR strOptions, CStringA &szReturn) { ...原创 2013-05-22 11:18:42 · 3125 阅读 · 2 评论 -
使用Atl Base64 对文件编解码
#include "atlenc.h"errno_t fileBase64Encode(const char *srcFile, const char *dstFile){ FILE *fr = NULL, *fw = NULL; errno_t err = 0; if(err == 0) { err= fopen_s(&fr, srcFile原创 2012-09-29 08:59:43 · 4290 阅读 · 0 评论 -
MD5 计算类
#pragma once//参考RFC1321标准//参考资料见 http://www.ietf.org/rfc/rfc1321.txtclass CMD5Sum{private:#define S11 7#define S12 12#define S13 17#define S14 22#define S21 5#define S22 9#原创 2010-06-24 17:35:00 · 1904 阅读 · 2 评论 -
使用 ICMP 和 RAW Sockets实现 ping 类
//// Ping.h//#ifndef __PING_H#define __PING_H#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <winsock.h>#pragma comment(lib, "ws2_32.lib")class CP...原创 2010-05-19 22:28:00 · 5069 阅读 · 2 评论 -
通过MSDN上的例子学习管道读写技术
/******************************************************************************/* This is a part of the Microsoft Source Code Samples. * Copyright (C) 1993-1997 Microsoft Corporation.翻译 2010-01-11 22:13:00 · 1180 阅读 · 0 评论 -
通过GetAdaptersInfo获取网卡MAC
int GetMacAddress(CStringArray &LanMAC) { #define MAX_ADAPTER_NAME_LENGTH 256 #define MAX_ADAPTER_DESCRIPTION_LENGTH 128 #define MAX_ADAPTER_ADDRESS_LENGTH 8 typedef struct _NET_IP_ADD原创 2009-09-26 00:23:00 · 4031 阅读 · 0 评论 -
InternetGetConnectedState
#include #pragma comment(lib, "Wininet.lib")DWORD GetInternetConnectedState(){ DWORD dwFlags = 0; if( InternetGetConnectedState( &dwFlags, 0) ) {#ifndef INTERNET_CONNECTION_CONFIGUR原创 2010-04-15 23:00:00 · 2530 阅读 · 0 评论 -
映射网络共享资源为本地硬盘
#include "stdafx.h"#include #include #include #pragma comment(lib, "mpr.lib")//添加映射DWORD AddConnection(LPCTSTR szRemoteName, LPCTSTR szLocalname){ // // Assign values to the原创 2012-05-28 11:20:31 · 2410 阅读 · 0 评论 -
SHA1 计算类
//SHA1_Class.h#pragma once//RFC 3174 US Secure Hash Algorithm 1 (SHA1)/* * If you do not have the ISO standard stdint.h header file, then you * must typdef the following: *原创 2012-06-06 16:40:05 · 2454 阅读 · 0 评论 -
从静态框派生的超链接控件
// HyperLink.h : header file// HyperLink static control. Will open the default browser with the given URL// when the user clicks on the link.#pragma once///////////////////////////////////原创 2012-06-06 16:51:38 · 1260 阅读 · 0 评论 -
gethostbyname获取IP地址
#include int GetIPAddr(LPCSTR hostname){ int nAdapter = 0; if(AfxSocketInit()) { HOSTENT *pHostEnt = gethostbyname(hostname); if(pHostEnt) { if(pHostEnt->h_addrtype ==原创 2012-08-03 13:40:50 · 5850 阅读 · 0 评论 -
解决CFtpFileFind在Unicode版本下GetFileURL不能正确返回路径
最近看到 CFtpFileFind GetFileURL 不能正确返回路径在VS2008下测试了一下确实有BUG, 多字节版本下是正常的, 而UNICODE版本下没有后面的文件名大概调试追踪了一下, 先分析GetFileURLCString CFtpFileFind::GetFileURL() const{ ASSERT_VALID(this); ASSERT(m_hC...原创 2019-06-05 09:52:08 · 1011 阅读 · 0 评论