#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
int create_tcp_socket();
char *get_ip(char *host);
char *build_get_query(char *host, char *page);
void usage();
#define HOST "coding.debuntu.org"
#define PAGE "/"
#define PORT 80
#define USERAGENT "HTMLGET 1.0"
int main(int argc, char **argv)
{
struct sockaddr_in *remote;
int sock;
int tmpres;
char *ip;
char *get;
char buf[BUFSIZ+1];
char *host;
char *page;
if(argc == 1){
usage();
exit(2);
}
host = argv[1];
if(argc > 2){
page = argv[2];
}else{
page = PAGE;
}
sock = create_tcp_socket();
ip = get_ip(host);
fprintf(stderr, "IP is %s\n", ip);
remote = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in *));
remote->sin_family = AF_INET;
tmpres = inet_pton(AF_INET, ip, (void *)(&(remote->sin_addr.s_addr)));
if( tmpres < 0)
{
perror("Can't set remote->sin_addr.s_addr");
exit(1);
}else if(tmpres == 0)
{
fprintf(stderr, "%s is not a valid IP address\n", ip);
exit(1);
}
remote->sin_port = htons(PORT);
if(connect(sock, (struct sockaddr *)remote, sizeof(struct sockaddr)) < 0){
perror("Could not connect");
exit(1);
}
get = build_get_query(host, page);
fprintf(stderr, "Query is:\n<<START>>\n%s<<END>>\n", get);
//Send the query to the server
int sent = 0;
while(sent < strlen(get))
{
tmpres = send(sock, get+sent, strlen(get)-sent, 0);
if(tmpres == -1){
perror("Can't send query");
exit(1);
}
sent += tmpres;
}
//now it is time to receive the page
memset(buf, 0, sizeof(buf));
int htmlstart = 0;
char * htmlcontent = NULL;
while((tmpres = recv(sock, buf, BUFSIZ, 0)) > 0){
if(htmlstart == 0)
{
/* Under certain conditions this will not work.
* If the \r\n\r\n part is splitted into two messages
* it will fail to detect the beginning of HTML content
*/
htmlcontent = strstr(buf, "\r\n\r\n");
if(htmlcontent != NULL){
htmlstart = 1;
htmlcontent += 4;
}
}else{
htmlcontent = buf;
}
if(htmlstart){
fprintf(stdout, "%s", htmlcontent);
}
memset(buf, 0X0, tmpres);
}
if(tmpres < 0)
{
perror("Error receiving data");
}
free(get);
free(remote);
free(ip);
close(sock);
return 0;
}
void usage()
{
fprintf(stderr, "USAGE: htmlget host [page]\n\
\thost: the website hostname. ex: coding.debuntu.org\n\
\tpage: the page to retrieve. ex: index.html, default: /\n");
}
int create_tcp_socket()
{
int sock;
if((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0){
perror("Can't create TCP socket");
exit(1);
}
return sock;
}
char *get_ip(char *host)
{
struct hostent *hent;
int iplen = 15; //XXX.XXX.XXX.XXX
char *ip = (char *)malloc(iplen+1);
memset(ip, 0, iplen+1);
if((hent = gethostbyname(host)) == NULL)
{
herror("Can't get IP");
exit(1);
}
if(inet_ntop(AF_INET, (void *)hent->h_addr_list[0], ip, iplen) == NULL)
{
perror("Can't resolve host");
exit(1);
}
return ip;
}
char *build_get_query(char *host, char *page)
{
char *query;
char *getpage = page;
char *tpl = "GET /%s HTTP/1.0\r\nHost: %s\r\nUser-Agent: %s\r\n\r\n";
if(getpage[0] == '/'){
getpage = getpage + 1;
fprintf(stderr,"Removing leading \"/\", converting %s to %s\n", page, getpage);
}
// -5 is to consider the %s %s %s in tpl and the ending \0
query = (char *)malloc(strlen(host)+strlen(getpage)+strlen(USERAGENT)+strlen(tpl)-5);
sprintf(query, tpl, getpage, host, USERAGENT);
return query;
}
Hey Guys !
ReplyDeleteUSA Fresh & Verified SSN Leads AVAILABLE with best connectivity
All Leads have genuine & valid information
**HEADERS IN LEADS**
First Name | Last Name | SSN | Dob | DL Number |Address | State | City | Zip | Phone Number | Account Number | Bank NAME
*Price for SSN lead $2
*You can ask for sample before any deal
*If anyone buy in bulk, we can negotiate
*Sampling is just for serious buyers
==>ACTIVE & FRESH CC FULLZ ALSO AVAILABLE<==
->$5 PER EACH
->Hope for the long term deal
->Interested buyers will be welcome
**Contact 24/7**
Whatsapp > +923172721122
Email > leads.sellers1212@gmail.com
Telegram > @leadsupplier
ICQ > 752822040
CAN YOUR LOST FUNDS BE RECOVERED?
ReplyDelete100% YES. Expressive question entreated by victims. Here is the reason you need to know about the GLOBALKOS HACK TEAM.
HEAR MY STORY. Valuable information and Privileges comes rare. People barely know what they have never experienced. I was a victim of a scam. Anyone from all walks of life can fall a victim when the time is right. I recalled how I came across a business website who promised a huge return on investment. I was so convinced. The website was good and after it whole convincement, I ended up depositing 7,000 dollars. I was silly and excited to think I could get 200% return on my investment the next day. the next day came, i requested for my profit then got nothing. To cut the story short, I realized I have lost my money after the story which was conveyed to me was mistrustful. I am a police officer whose practice also specializes in evaluation of such psychological play. I would believe not to have fallen for such deceit on a good day.
After a year, I saw a review online that navigated me to the global KOS hacker who used a hack protocol’s , whereby the locations and data of the deceptive provenience were traced into their monetary base network. He was able to recover more than what I lost. I was perplexed as I wouldn’t have thought i could encounter such guru. I feel so much happy till this date. I am sharing with you this, because so much people could benefit from the high classified information. This company is large enough to provide comprehensive range of services such as.
🔸MOBILE PHONE HACKS.(Catching A Cheating Spouse)
🔸CREDIT SCORE UPGRADE,
🔸PENETRATION OF WEBSITES AND DATABASE.
For prolific services and info,
Contact the gurus.
At theglobalkos@gmail.com
I-C-Q 752822040
ReplyDeleteTeLe GrAm @killhacks
All types of Fresh FUllZ Available in bulk quantity
SSN+DOB
SSN+DOB+DL
High Credit Scroes Fullz (USA)
CC FULLZ WITH CVV (vbv/non vbv)
DUMPS WITH PIN CODES TRACK 101 & 202
HAC-KING/SPA-MMING/CAR-DING/SCR-iPTING
All Tools & Complete Tutorials Guide
Cpan-els/Shells
Key-loggers/RAT-S
SM-TP/RDP
MAIL-ERS
DE-EP/DAR-K WEB COMPLETE COURSE
I-C-Q 752822040
TeLe GrAm @killhacks
CONTACT