// 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的更多相关文章

  1. 网站指纹识别工具——WhatWeb v0.4.7发布

      WhatWeb是一款网站指纹识别工具,主要针对的问题是:“这个网站使用的什么技术?”WhatWeb可以告诉你网站搭建使用的程序,包括何种CMS系统.什么博客系统.Javascript库.web服务 ...

  2. Android指纹识别深入浅出分析到实战(6.0以下系统适配方案)

    指纹识别这个名词听起来并不陌生,但是实际开发过程中用得并不多.Google从Android6.0(api23)开始才提供标准指纹识别支持,并对外提供指纹识别相关的接口.本文除了能适配6.0及以上系统, ...

  3. Android开发学习之路-指纹识别api

    在android6.0之后谷歌对指纹识别进行了官方支持,今天还在放假,所以就随意尝试了一下这个api,但是遇到了各种各样的问题 ①在使用FingerPrintManager这个类实现的时候发现了很多问 ...

  4. FingerprintJS - 在浏览器端实现指纹识别

    FingerprintJS 是一个快速的浏览器指纹库,纯 JavaScript 实现,没有依赖关系.默认情况下,使用 Murmur Hash 算法返回一个32位整数.Hash 函数可以很容易地更换. ...

  5. WAF指纹识别和XSS过滤器绕过技巧

    [译文] -- “Modern Web Application Firewalls Fingerprinting and Bypassing XSS Filters” 0x1 前言 之前在乌云drop ...

  6. iOS 钥匙串 指纹识别 get和Post请求的区别

    01-钥匙串 1. 通过系统提供的钥匙串功能可以在本地保存密码,系统使用AES的方式对密码加密 a. 查看Safari中保存的密码 2. 使用第三方框架SSKeychain把密码保存到钥匙串和获取钥匙 ...

  7. iOS - TouchID 指纹识别

    前言 NS_CLASS_AVAILABLE(10_10, 8_0) @interface LAContext : NSObject 指纹识别功能是 iPhone 5s 推出的,SDK 是 iOS 8. ...

  8. iOS开发——Touch ID 指纹识别

    项目中为了安全性,一般使用密码或iPhone手机的指纹识别Touch ID. 第一步,判断系统是否支持,iOS8.0及以上才支持. 第二步,判断手机是否支持,带Touch ID的手机iPhone5s及 ...

  9. iOS指纹识别

    #import "ViewController.h" #import <LocalAuthentication/LocalAuthentication.h> @inte ...

随机推荐

  1. mysql 存储二进制数据

    晚上小研究了下MySQL存储于读取二进制数据的功能.关键步骤为以下三点: 最重要的一点:存储二进制数据的表的类型需要是blob类型(按长度不同分为tiny, media, long) 插入二进制数据时 ...

  2. iOS学习笔记(十一)——JSON数据解析

    在之前的<iOS学习——xml数据解析(九)>介绍了xml数据解析,这一篇简单介绍一下Json数据解析.JSON 即 JavaScript Object Natation,它是一种轻量级的 ...

  3. Axis2Service客户端访问通用类集合List自定义类型

    Axis2 服务四种客户端调用方式: 1.AXIOMClient 2.generating a client using ADB 3.generating a client using XMLBean ...

  4. Introduction to Mathematical Thinking - Week 2

    基本数学概念 real number(实数):是有理数和无理数的总称 有理数:可以表达为两个整数比的数(a/b, b!=0) 无理数是指除有理数以外的实数 imply -- 推导出 不需要 A 能推导 ...

  5. python系列四:Python3字符串

    #!/usr/bin/python #Python3 字符串#可以截取字符串的一部分并与其他字段拼接var1 = 'Hello World!'print ("已更新字符串 : ", ...

  6. Google 翻译如何获取 tk 参数值?

    1.首先获取 TKK 参数,这个参数可以在 https://translate.google.com 网页获取, src:TKK=eval('((function(){var a\x3d2089517 ...

  7. InnoDB buffer pool 刷新快慢取决因素

    innodb buffer pool 刷新快慢取决于两个参数 mysql> show variables like 'innodb_io_capacity%';+---------------- ...

  8. 实验一中的OOP思想

    子类继承父类    父类中声明了接口变量   接口AB中声明了抽象方法 ab 在子类中 可以用这样通俗的语句写程序: while (!(this.termination.shouldTerminate ...

  9. Python之迭代器和生成器(Day17)

    一.可迭代对象(iterable) 刚才说过,很多容器都是可迭代对象,此外还有更多的对象同样也是可迭代对象,比如处于打开状态的files,sockets等等.但凡是可以返回一个迭代器的对象都可称之为可 ...

  10. 编译安装 nginx的http_stub_status_module监控其运行状态

    步骤: 1 编译nginx,加上参数 --with-http_stub_status_module 以我自己的编译选项为例: #配置指令 ./configure --prefix=/usr/local ...