This article is a mirror article of machine translation, please click here to jump to the original article.

View: 6186|Reply: 0

【Turn】CURL command uses proxies and proxies are introduced

[Copy link]
Posted on 10/10/2022 12:20:31 PM | | |
Sometimes for privacy reasons, we want to hide our IP so that the http server cannot record that we have accessed it, and then we can use a proxy server.

Proxy Server is a service application that works between the browser and the http server, and all http requests that pass through the proxy server will be forwarded to the corresponding http server.

Of course, in addition to HTTP proxy, https, ftp, RTSP, pop3 and other protocols can also be accessed by proxy, but this article introduces proxies that support http and https protocol access.

1. Proxy server classification:

There are two main types of proxies that are commonly used and support the HTTP(S) protocol: HTTP proxies and SOCKS proxies, see the following table:

Category
Subcategory
Subcategories
description
http proxyhttp proxy
https proxy
Transparent proxyThe http server knows that the browser uses a proxy and can obtain the original IP address of the browser.
Anonymous agentsThe http server knows that the browser uses a proxy, but cannot obtain the original IP address of the browser side.
High anonymity proxiesThe http server does not know that the browser side uses a proxy and cannot obtain the original IP address of the browser side.
SOCKS AgentSOCKS4Known as the Almighty Generation
Reason, support http
and other agreements
Only TCP applications are supported.
SOCKS4ASupport TCP applications; Server-side domain name resolution is supported.
SOCKS5Support TCP and UDP applications; Server-side domain name resolution is supported.
Support multiple authentications; IPV6 support;


2. Linux curl command proxy setting parameters:

The Linux curl command can use the following parameters to set the HTTP(S) proxy and SOCKS proxy, and their usernames, passwords, and authentication methods have been set:

parameter
usage
-x host:port
-x [protocol://[user:pwd@]host[:port]
--proxy [protocol://[user:pwd@]host[:port]
Access using HTTP proxy; If no port is specified, port 8080 is used by default.
protocol defaults to http_proxy, other possible values include:
http_proxy、HTTPS_PROXY、socks4、socks4a、socks5;
As:
--proxy 8.8.8.8:8080;
-x "http_proxy://aiezu:123@aiezu.com:80"
--socks4 <host[:port]>
--socks4a <host[:port]>
--socks5 <host[:port]>
Use SOCKS4 agents;
Use SOCKS4A agents;
Use SOCKS5 agents;
This parameter overrides the "-x" parameter;
--proxy-anyauth
--proxy-basic
--proxy-diges
--proxy-negotiate
--proxy-ntlm
Agent authentication methods, reference:
--anyauth
--basic
--diges
--negotiate
--ntlm
-U <user:password>
--proxy-user <user:password>
Set the proxy's username and password;


3. Linux curl command setting proxy example:

1. Linux curl command to set HTTP proxy:

# Specify the http proxy IP and port
curl -x 113.185.19.192:80http://aiezu.com/test.php
curl --proxy 113.185.19.192:80http://aiezu.com/test.php

#指定为http代理
curl -x http_proxy://113.185.19.192:80http://aiezu.com/test.php

#指定为https代理
curl -x HTTPS_PROXY://113.185.19.192:80http://aiezu.com/test.php

#指定代理用户名和密码, basic authentication method
curl -x aiezu:123456@113.185.19.192:80http://aiezu.com/test.php
curl -x 113.185.19.192:80 -U aiezu:123456http://aiezu.com/test.php
curl -x 113.185.19.192:80 --proxy-user aiezu:123456http://aiezu.com/test.php

#指定代理用户名和密码. NTLM authentication method
curl -x 113.185.19.192:80 -U aiezu:123456 --proxy-ntlmhttp://aiezu.com/test.php

#指定代理协议, username and password, basic authentication method
curl -x http_proxy://aiezu:123456@113.185.19.192:80http://aiezu.com/test.php
2. Linux curl command to set the socks agent:

#使用socks4代理, no authentication method is required
curl --socks4 122.192.32.76:7280http://aiezu.com/test.php
curl -x socks4://122.192.32.76:7280http://aiezu.com/test.php

#使用socks4a代理, no authentication method is required
curl --socks4a 122.192.32.76:7280http://aiezu.com/test.php
curl -x socks4a://122.192.32.76:7280http://aiezu.com/test.php

#使用socks5代理, basic authentication method
curl --socks5 122.192.32.76:7280 -U aiezu:123456http://aiezu.com/test.php
curl -x socks5://aiezu:123456@122.192.32.76:7280http://aiezu.com/test.php

#使用socks5代理, basic authentication method, NTLM authentication method
curl -x socks5://aiezu:123456@122.192.32.76:7280 --proxy-ntlmhttp://aiezu.com/test.php


Original address:The hyperlink login is visible.




Previous:[WebView2] (4) Web and WinForm call function methods to each other
Next:[WebView2] (5) Loading local HTML resources of the virtual host
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com