mehrdadrad / mylg

Network Diagnostic Tool
http://mylg.io
MIT License
2.69k stars 231 forks source link

add curl support #41

Closed jungle-boogie closed 7 years ago

jungle-boogie commented 7 years ago

Hi,

Even though a host may be reachable via icmp/udp, the webserver may have an issue and not display the contents of the website.

Have you ever used curl to see how far the application layer connection gets? Maybe it would be beneficial to add in some kind of fetching application data support. I think this would be especially beneficial with the neat lg support you've added in. Of course I don't know if this is actually something that can be done, just an idea.

jungle-boogie commented 7 years ago

Looking closely, I see you have hping included, but it doesn't seem to work in lg mode:

lg/telia/los angeles> hping
lg/telia/los angeles>

Is it possible to have hping work in this mode?

mehrdadrad commented 7 years ago

yes, that's a great feature but unfortunately, the telia or level3 doesn't support http ping.

jungle-boogie commented 7 years ago

Can curl-like support be added to hping?

% curl -v github.com
* Rebuilt URL to: github.com/
*   Trying 192.30.253.112...
* TCP_NODELAY set
* Connected to github.com (192.30.253.112) port 80 (#0)
> GET / HTTP/1.1
> Host: github.com
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Content-length: 0
< Location: https://github.com/
< Connection: close
<
* Curl_http_done: called premature == 0
* Closing connection 0
% curl -I https://github.com
HTTP/1.1 200 OK
Server: GitHub.com
Date: Tue, 29 Nov 2016 17:22:31 GMT
Content-Type: text/html; charset=utf-8
Status: 200 OK
Cache-Control: no-cache
Vary: X-PJAX
X-UA-Compatible: IE=Edge,chrome=1
Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Sat, 29 Nov 2036 17:22:31 -0000; secure; HttpOnly
Set-Cookie: _gh_sess=eyJzZXNzaW9uX2lkIjoiYTlhNmUwNjQ3MjExYmNlYTcwODYyYTEzNWNiYjBiOWUiLCJfY3NyZl90b2tlbiI6IlBMSXR2WnZNWUVlN0M4OExvWks2Y2swQVRwNXlHOVB2eWhzRk5JNG9ka2s9In0%3D--f8e820d54f841684874f33562fd06422f31fd5ee; path=/; secure; HttpOnly
X-Request-Id: 2391bf200a640a34fb2040349edfd2f3
X-Runtime: 0.011810
Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src render.githubusercontent.com; connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Public-Key-Pins: max-age=5184000; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
Vary: Accept-Encoding
X-Served-By: a128136e4734a9f74c013356c773ece7
X-GitHub-Request-Id: 4460DE09:0852:23EE657E:583DB957

alternatively, take a look at https://github.com/jkbrzt/httpie

gummiboll commented 7 years ago

What features from curl would you like to have in hping? The ability to show headers or something else/more?

Spontaneously I kinda feel like this is a little outside of mylg hping's scope. I see hping as a tool to see if I can reach the specified server over HTTP/HTTPS or not, not if it actually works (i.e: ping it). If I wanted to know that, I would use curl or something similar.

But that's just my two cents

jungle-boogie commented 7 years ago

@gummiboll,

Yeah, fetching the headers is primarily what I was thinking of.

Spontaneously I kinda feel like this is a little outside of mylg hping's scope.

You're right, this is approaching feature creep.
If fetching headers isn't added, I won't get my feelings hurt as there's a few different options to fetch that that already.

What's your opinion on checking the MTU of a given host?