Java 是否可以使用VPN服务查看HTTPS请求的路径

Java 是否可以使用VPN服务查看HTTPS请求的路径,java,android,vpn,android-vpn-service,Java,Android,Vpn,Android Vpn Service,我需要能够看到通过承载本地VPN服务器的VPN服务进行的HTTPS连接的路径(如果可能的话,还有头)。这可能吗 例如,当我去的时候,我需要能够看到整个路径(例如google.com/somedir/somejsfile.js),而不是SNI(google.com)。在最终用户安全的情况下,这是否可能 我成功地处理了HTTP请求并成功地查看了HTTP请求,但是,现在大多数流量都是通过HTTPS的,所以我需要一种方法来通过HTTPS查看请求头 下面的代码显示了如何建立VPN服务,以及如何分别读取/写

我需要能够看到通过承载本地VPN服务器的VPN服务进行的HTTPS连接的路径(如果可能的话,还有头)。这可能吗

例如,当我去的时候,我需要能够看到整个路径(例如google.com/somedir/somejsfile.js),而不是SNI(google.com)。在最终用户安全的情况下,这是否可能

我成功地处理了HTTP请求并成功地查看了HTTP请求,但是,现在大多数流量都是通过HTTPS的,所以我需要一种方法来通过HTTPS查看请求头

下面的代码显示了如何建立VPN服务,以及如何分别读取/写入传入/传出数据包

private void runVPN()引发异常{
this.mVPNInterface=buildingvpn();
this.mVPNOutputStream=newfileoutputstream(mVPNInterface.getFileDescriptor());
FileInputStream in=新的FileInputStream(mVPNInterface.getFileDescriptor());
int size=0;
while(大小!=-1&&i正在运行){
while((size=in.read(mPacket))>0&正在运行){
if(mDnsProxy.Stopped | | mTcpProxyServer.Stopped){
in.close();
抛出新异常(“LocalServer已停止”);
}
onIPPacketReceived(mIPHeader,大小);
}
睡眠(100);
}
in.close();
断开vpn();
}
void onIPPacketReceived(IPHeader IPHeader,int size)引发IOException{
开关(ipHeader.getProtocol()){
案例IPHeader.TCP:
TCPHeader TCPHeader=mTCPHeader;
tcpHeader.mOffset=ipHeader.getHeaderLength();
if(tcpHeader.getSourcePort()==mTcpProxyServer.Port){
NatSession session=NatSessionManager.getSession(tcpHeader.getDestinationPort());
if(会话!=null){
ipHeader.setSourceIP(ipHeader.getDestinationIP());
tcpHeader.setSourcePort(session.RemotePort);
ipHeader.setDestinationIP(本地IP);
实用程序.ComputeTCPChecksum(ipHeader、tcpHeader);
mVPNOutputStream.write(ipHeader.mData、ipHeader.mOffset、size);
mReceivedBytes+=大小;
/*
mVPNOutputStream.write(ipHeader.mData、ipHeader.mOffset、size);
mReceivedBytes+=大小*/
}否则{
Log.d(标记,“NoSession:+ipHeader.toString()+”+tcpHeader.toString());
}
}否则{
int-portKey=tcpHeader.getSourcePort();
NatSession session=NatSessionManager.getSession(portKey);
if(session==null | | session.RemoteIP!=ipHeader.getDestinationIP()| | session.RemotePort
!=tcpHeader.getDestinationPort()){
session=NatSessionManager.createSession(portKey,ipHeader.getDestinationIP(),tcpHeader
.getDestinationPort());
}
session.lastnotime=System.nanoTime();
PacketSent++;
int tcpDataSize=ipHeader.getDataLength()-tcpHeader.getHeaderLength();
if(session.PacketSent==2&&tcpDataSize==0){
返回;
}
if(session.BytesSent==0&&tcpDataSize>10){
int dataOffset=tcpHeader.mOffset+tcpHeader.getHeaderLength();
HttpRequestHeaderParser.parseHttpRequestHeader(会话,tcpHeader.mData,数据偏移,
tcpDataSize);
//Log.d(标记“NatSession:+session”);
//Log.d(标记“Host:+session.RemoteHost”);
//Log.d(标记“Request:+session.Method+”+session.RequestUrl);
}
ipHeader.setSourceIP(ipHeader.getDestinationIP());
ipHeader.setDestinationIP(本地IP);
tcpHeader.setDestinationPort(mTcpProxyServer.Port);
实用程序.ComputeTCPChecksum(ipHeader、tcpHeader);
mVPNOutputStream.write(ipHeader.mData、ipHeader.mOffset、size);
session.BytesSent+=tcpDataSize;
mSentBytes+=大小;
}
打破
案例IPHeader.UDP:
UDPHeader UDPHeader=mUDPHeader;
udpHeader.mOffset=ipHeader.getHeaderLength();
if(ipHeader.getSourceIP()==LOCAL\u IP&&udpHeader.getDestinationPort()==53){
mDNSBuffer.clear();
mDNSBuffer.limit(udpHeader.getTotalLength()-8);
DnsPacket DnsPacket=DnsPacket.fromBytes(mDNSBuffer);
如果(dnsPacket!=null&&dnsPacket.Header.QuestionCount>0){
mDnsProxy.ONDNSREQUESTERVIED(ipHeader、udpHeader、dnsPacket);
}
}
打破
}
}
非常感谢您对这个问题的任何帮助或指导

先谢谢你