HTTP 指纹识别v0.1
// Winhttp.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <winhttp.h>
#include <comdef.h>
#pragma comment (lib,"Winhttp.lib")
BOOL request_http(wchar_t* Host,int port);
BOOL request_https(wchar_t* Host,int port);
struct Plist
{
wchar_t Host[65500];
int port[7];
}; DWORD WINAPI ThreadProc(LPVOID Lpparam)
{
Plist *tp = (Plist*)Lpparam;
int now_port;
wchar_t Hostname[65500] = {0};
for (int i =2;i<255;i++)
{
wsprintfW(Hostname,L"%s.%d",tp->Host,i);
for (int j =0;j<7;j++)
{
now_port = tp->port[j];
printf("[-]:ScannerIng Host:%S Port:%d\r\n",Hostname,now_port);
if (now_port == 443 || now_port == 8443)
{
request_https(Hostname,now_port);
}else
{
request_http(Hostname,now_port);
}
}
}
return 0;
} BOOL request_https(wchar_t* Host,int port)
{
DWORD dwSize = 0;
wchar_t* Servers;
wchar_t* Power_by;
DWORD dwDownloaded = 0;
LPSTR pszOutBuffer = NULL;
wchar_t* lpOutBuffer = NULL;
BOOL bResults = FALSE;
HINTERNET hSession = NULL,
hConnect = NULL,
hRequest = NULL; // Use WinHttpOpen to obtain a session handle.
hSession = WinHttpOpen( L"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, 0); WinHttpSetTimeouts( hSession, 5000, 5000, 5000, 5000);
// Specify an HTTP server.
if (hSession)
hConnect = WinHttpConnect( hSession,Host, //test website:www.esafe.com.tw
port, 0); // Create an HTTP request handle.
if (hConnect)
hRequest = WinHttpOpenRequest( hConnect, L"GET",L"/",
NULL, WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
WINHTTP_FLAG_SECURE); DWORD options = SECURITY_FLAG_IGNORE_CERT_CN_INVALID |
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |
SECURITY_FLAG_IGNORE_UNKNOWN_CA ; if( hRequest )
bResults = WinHttpSetOption( hRequest, WINHTTP_OPTION_SECURITY_FLAGS ,
(LPVOID)&options, sizeof (DWORD) ); if(bResults == FALSE){
printf("Error in WinHttpQueryOption WINHTTP_OPTION_SECURITY_FLAGS: %ld\n",GetLastError());
} if (hRequest)
bResults = WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS,
0, WINHTTP_NO_REQUEST_DATA, 0,
0, 0);
if (bResults)
bResults = WinHttpReceiveResponse( hRequest, NULL); if (bResults)
{
WinHttpQueryHeaders( hRequest, WINHTTP_QUERY_RAW_HEADERS_CRLF,
WINHTTP_HEADER_NAME_BY_INDEX, NULL,
&dwSize, WINHTTP_NO_HEADER_INDEX); // Allocate memory for the buffer.
if( GetLastError( ) == ERROR_INSUFFICIENT_BUFFER )
{
lpOutBuffer = new WCHAR[dwSize/sizeof(WCHAR)]; // Now, use WinHttpQueryHeaders to retrieve the header.
bResults = WinHttpQueryHeaders( hRequest,
WINHTTP_QUERY_RAW_HEADERS_CRLF,
WINHTTP_HEADER_NAME_BY_INDEX,
lpOutBuffer, &dwSize,
WINHTTP_NO_HEADER_INDEX);
}
}
if (bResults)
{
Power_by = wcsstr(lpOutBuffer,L"X-Powered-By:");
if (Power_by != NULL)
{
for (int i =0;i<wcslen(Power_by);i++)
{
if (Power_by[i] == '\r')
{
Power_by[i] = '\0';
}
}
}
Servers = wcsstr(lpOutBuffer,L"Server:");
if (Servers != NULL)
{
for (int j=0;j<wcslen(Servers);j++)
{
if (Servers[j] == '\r')
{
Servers[j] = '\0';
}
}
}
printf("[+]:Host:%S Port:%d %S %S\n",Host,port,Servers,Power_by);
delete[] lpOutBuffer;
} if (!bResults)
{
//printf("Error in :%d.\r\n",GetLastError());
return FALSE;
} if( hRequest ) WinHttpCloseHandle( hRequest );
if( hConnect ) WinHttpCloseHandle( hConnect );
if( hSession ) WinHttpCloseHandle( hSession );
return TRUE;
} BOOL request_http(wchar_t* Host,int port)
{
DWORD dwSize = 0;
wchar_t* Servers_head = NULL;
wchar_t* Powered_head = NULL;
wchar_t* lpOutBuffer = NULL;
BOOL bResults = FALSE;
HINTERNET hSession = NULL,hConnect = NULL,hRequest = NULL; // Use WinHttpOpen to obtain a session handle.
hSession = WinHttpOpen( L"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, 0); WinHttpSetTimeouts( hSession, 5000, 5000, 5000, 5000); //settimeout
// Specify an HTTP server.
if (hSession)
hConnect = WinHttpConnect( hSession, Host,
port, 0); // Create an HTTP request handle.
if (hConnect)
hRequest = WinHttpOpenRequest( hConnect, L"GET", NULL,
NULL, WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
0); // Send a request.
if (hRequest)
bResults = WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS,
0, WINHTTP_NO_REQUEST_DATA, 0,
0, 0); // End the request.
if (bResults)
bResults = WinHttpReceiveResponse( hRequest, NULL); // First, use WinHttpQueryHeaders to obtain the size of the buffer.
if (bResults)
{
WinHttpQueryHeaders( hRequest, WINHTTP_QUERY_RAW_HEADERS_CRLF,
WINHTTP_HEADER_NAME_BY_INDEX, NULL,
&dwSize, WINHTTP_NO_HEADER_INDEX); // Allocate memory for the buffer.
if( GetLastError( ) == ERROR_INSUFFICIENT_BUFFER )
{
lpOutBuffer = new WCHAR[dwSize/sizeof(WCHAR)]; // Now, use WinHttpQueryHeaders to retrieve the header.
bResults = WinHttpQueryHeaders( hRequest,
WINHTTP_QUERY_RAW_HEADERS_CRLF,
WINHTTP_HEADER_NAME_BY_INDEX,
lpOutBuffer, &dwSize,
WINHTTP_NO_HEADER_INDEX);
}
} // Print the header contents.
if (bResults)
{
// Powered_head = wcsstr(lpOutBuffer,L"X-Powered-By:");
Powered_head = wcsstr(lpOutBuffer,L"X-Powered-By:");
if (Powered_head != NULL)
{
for (int i =0;i<wcslen(Powered_head);i++)
{
if (Powered_head[i] == '\r')
{
Powered_head[i] = '\0';
}
}
}
Servers_head = wcsstr(lpOutBuffer,L"Server:");
if (Servers_head != NULL)
{
for (int j=0;j<wcslen(Servers_head);j++)
{
if (Servers_head[j] == '\r')
{
Servers_head[j] = '\0';
}
}
}
printf("[+]:Host:%S Port:%d %S %S\n",Host,port,Servers_head,Powered_head);
delete [] lpOutBuffer;
} // Report any errors.
if (!bResults)
//printf("Host:%S Port:%d Close \r\n",Host,port);
; // Close any open handles.
if (hRequest) WinHttpCloseHandle(hRequest);
if (hConnect) WinHttpCloseHandle(hConnect);
if (hSession) WinHttpCloseHandle(hSession);
return TRUE;
} void Usage(wchar_t* prog)
{
printf("[*]:%S Usage-> Hostname Host->Port.\r\n",prog);
printf("[*]:%S Usage-> Http -> Headers.\r\n",prog);
printf("[*]:90Sec Security Team@Agile.\r\n");
} int wmain(int argc,wchar_t* argv[])
{
HANDLE Hthread;
Plist tp; //struct
if (argc != 2)
{
Usage(argv[0]);
return 0;
}
lstrcpyW(tp.Host,argv[1]);
//printf("tp Host = %S.\r\n",tp.Host); tp.port[0] = 80;
tp.port[1] = 8080;
tp.port[2] = 8000;
tp.port[3] = 8090;
tp.port[4] = 8888;
tp.port[5] = 443;
tp.port[6] = 8443; Hthread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ThreadProc,&tp,0,NULL);
if (Hthread == INVALID_HANDLE_VALUE)
{
printf("Create Thread Error.\r\n");
return 0;
}else
{
;//printf("Create Thread suscess.\r\n");
} WaitForSingleObject(Hthread,INFINITE);
CloseHandle(Hthread);
return 0;
}
HTTP 指纹识别v0.1的更多相关文章
- 网站指纹识别工具——WhatWeb v0.4.7发布
WhatWeb是一款网站指纹识别工具,主要针对的问题是:“这个网站使用的什么技术?”WhatWeb可以告诉你网站搭建使用的程序,包括何种CMS系统.什么博客系统.Javascript库.web服务 ...
- Android指纹识别深入浅出分析到实战(6.0以下系统适配方案)
指纹识别这个名词听起来并不陌生,但是实际开发过程中用得并不多.Google从Android6.0(api23)开始才提供标准指纹识别支持,并对外提供指纹识别相关的接口.本文除了能适配6.0及以上系统, ...
- Android开发学习之路-指纹识别api
在android6.0之后谷歌对指纹识别进行了官方支持,今天还在放假,所以就随意尝试了一下这个api,但是遇到了各种各样的问题 ①在使用FingerPrintManager这个类实现的时候发现了很多问 ...
- FingerprintJS - 在浏览器端实现指纹识别
FingerprintJS 是一个快速的浏览器指纹库,纯 JavaScript 实现,没有依赖关系.默认情况下,使用 Murmur Hash 算法返回一个32位整数.Hash 函数可以很容易地更换. ...
- WAF指纹识别和XSS过滤器绕过技巧
[译文] -- “Modern Web Application Firewalls Fingerprinting and Bypassing XSS Filters” 0x1 前言 之前在乌云drop ...
- iOS 钥匙串 指纹识别 get和Post请求的区别
01-钥匙串 1. 通过系统提供的钥匙串功能可以在本地保存密码,系统使用AES的方式对密码加密 a. 查看Safari中保存的密码 2. 使用第三方框架SSKeychain把密码保存到钥匙串和获取钥匙 ...
- iOS - TouchID 指纹识别
前言 NS_CLASS_AVAILABLE(10_10, 8_0) @interface LAContext : NSObject 指纹识别功能是 iPhone 5s 推出的,SDK 是 iOS 8. ...
- iOS开发——Touch ID 指纹识别
项目中为了安全性,一般使用密码或iPhone手机的指纹识别Touch ID. 第一步,判断系统是否支持,iOS8.0及以上才支持. 第二步,判断手机是否支持,带Touch ID的手机iPhone5s及 ...
- iOS指纹识别
#import "ViewController.h" #import <LocalAuthentication/LocalAuthentication.h> @inte ...
随机推荐
- 锁(java, DB)
知识点 事务 锁(java, DB) 多线程知识点整理 锁(java, DB) 什么是锁 对资源的访问权限进行控制 如果把一个资源(对象)比喻成屋子.就好像你进入了屋子锁上了门.你家人和贼都进不去了. ...
- PHP输出语句大杂烩
一 echo echo() 实际上不是一个函数,是php语句,因此您无需对其使用括号.不过,如果您希望向 echo() 传递一个以上的参数,那么使用括号会发生解析错误.而且echo是返回void的,并 ...
- outlook撤回已发送邮件
官方教程参考: https://support.office.com/zh-cn/article/%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6%E5%90%8E%E6%92 ...
- angularjs 遇见$scope,xxx=function()报错为该函数未定义
本包子今天遇见一个问题,就是明明写了$scope,xx=function()但是报错了,报错显示是该函数未定义,我就很着急的先将函数写成一个全局函数,就没问题,等下午有空的时候寻思了一下,为什么全局就 ...
- api文档的书写
写文档写要与写代码一样,增加复用. 比如 model 说明就只需要一个,api中含有哪些字段,就在api说明中增加到那些 models 的链接. 使用 sophinx 如何生成目录 .. toctre ...
- CalendarUtil 日期操作工具类
版权声明:本文为博主原创文章,未经博主允许不得转载. [java] view plain copy import java.util.Calendar; import java.text.DateFo ...
- 报表生成之Hyperion SQR
SQR(Structured Query Reporter)是为从数据库管理系统生成报告而设计的一种编程语言.名称是结构化查询报告的缩写,这表明它与SQL(结构化查询语言)的关系.任何SQL语句可以嵌 ...
- 我的Android进阶之旅------>Android百度地图定位SDK功能学习
因为项目需求,需要使用百度地图的定位功能,因此去百度地图开发平台下载了百度地图的Android定位SDK最新版本的开发包和示例代码学习. Android 定位SDK地址:http://develope ...
- 我的Android进阶之旅------>HTTP Content-type 对照表
HTTP Content-type 对照表 文件扩展名 Content-Type(Mime-Type) 文件扩展名 Content-Type(Mime-Type) .*( 二进制流, 不知道下载文件类 ...
- 斯坦福大学Andrew Ng - 机器学习笔记(3) -- 神经网络模型
大概用了一个月,Andrew Ng老师的机器学习视频断断续续看完了,以下是个人学习笔记,入门级别,权当总结.笔记难免有遗漏和误解,欢迎讨论. 鸣谢:中国海洋大学黄海广博士提供课程视频和个人笔记,在此深 ...