Rabu, 01 Februari 2012

INFORMATION ABOUT TOR and PROXYCHAINS


TOR

  Simply this: If we normally download anapplication or software from Download.com wewill download the file from Download.com server,they indirectly by having to provide the file to bedownloaded a lot of people, we can imagine a time when there 100 thousand people who download the file simultaneously fromDownload.com site, how much bandwidth they spent? (to my knowledge) that would be verywasteful.
In contrast with Bittorrent, logically continue to provide the file server applications or software asa source for download (server here does not mean a site or the provider files, but also as someone who can distribute the files are) listedon the tracker in the file. Torrent, but the difference if there are already some people from100 thousand pendownload downloading the fileis completed, then another pendownload not need to download files directly from the source,but can take part or bits of several people whoalso take part or who have downloaded the file,those who finished downloading is usually calledseeders, and the downloading of thesecommonly called seeders or leechers peers, to be more clear I give an illustration which I took from wikipedia.
Illustration BitTorrent data transfer:
 
tracker
  tracker is a connection manager that serves as the coordination for the transportation of dataover p2p protocols, more clearly see here
peers
  Seed / Seeders: the owner of the file or files as well as a provider.
  Leech / Leechers: downloading the file.
note: to get good download speeds that we ought to take into account the number of peers(seeds / leechs, remember! the greater number of seeds will then download the high speed, the greater number of leechs then logically the download speed will be low (assuming the download speed is divided by a large number ofleechs).


PROXYCHAINS

Proxychains usually can not just compile on OSX, need modification. To more easily able to use the patch. This information is obtained from here.As usual, I wrote back to archive on the blog.
1. Download proxychains.
 2. Apply the patch, the following patch:
 
 diff-run proxychains-3.1/proxychains/Makefile.in proxychains-3.1_resolv/proxychains/Makefile.in
 2006-03-15 10:16:59.000000000 -0600 --- proxychains-3.1/proxychains/Makefile.in
 + + + 2011-06-16 13:17:20.000000000 -0500 proxychains-3.1_resolv/proxychains/Makefile.in
 -121.7 +121.7 @ @ @ @
 LIBS = @ LIBS @
 libproxychains_la_DEPENDENCIES =
 libproxychains_la_OBJECTS = libproxychains.lo core.lo
 -CFLAGS = @ CFLAGS @
 + CFLAGS = @ CFLAGS @-arch i386-arch x86_64
 COMPILE = $ (CC) $ (DEFS) $ (includes) $ (AM_CPPFLAGS) $ (CPPFLAGS) $ (AM_CFLAGS) $ (CFLAGS)
 LTCOMPILE = $ (libtool) - mode = compile $ (CC) $ (DEFS) $ (includes) $ (AM_CPPFLAGS) $ (CPPFLAGS) $ (AM_CFLAGS) $ (CFLAGS)
 CCLD = $ (CC)
 diff-run proxychains-3.1/proxychains/core.c proxychains-3.1_resolv/proxychains/core.c
 2006-03-15 10:16:59.000000000 -0600 --- proxychains-3.1/proxychains/core.c
 + + + 2011-06-16 13:17:19.000000000 -0500 proxychains-3.1_resolv/proxychains/core.c
 -35.12 +35.18 @ @ @ @
 # Include
 # Include
 # Include
 + # Include
 # Include "core.h"
 
 extern int tcp_read_time_out;
 extern int tcp_connect_time_out;
 extern int proxychains_quiet_mode;
 -
 + Extern connect_t true_connect;
 + Extern getaddrinfo_t true_getaddrinfo;
 + Extern freeaddrinfo_t true_freeaddrinfo;
 + Extern getnameinfo_t true_getnameinfo;
 + Extern gethostbyaddr_t true_gethostbyaddr;
 +
 static const char base64 [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 + /";
 static void encode_base_64 (char * src, char * dest, int max_len)
 -159.13 +165.14 @ @ @ @
 PFD [0]. fd = sock;
 PFD [0]. events = POLLOUT;
 - Fcntl (sock, F_SETFL, O_NONBLOCK);
 + Fcntl (sock, F_SETFL, O_NONBLOCK);
 ret = true_connect (sock, addr, len);
 - / / Printf ("\ nconnect ret =% d \ n", ret); fflush (stdout);
 + / / Printf ("\ nconnect ret =% d \ n", ret); fflush (stdout);
 +
 if (ret ==- 1 & & errno == EINPROGRESS)
 {
 ret = poll (PFD, 1, tcp_connect_time_out);
 - / / Printf ("\ npoll ret =% d \ n", ret); fflush (stdout);
 + / / Printf ("\ npoll ret =% d \ n", ret); fflush (stdout);
 if (ret == 1)
 {
 value_len = sizeof (int);
 -388.14 +395.18 @ @ @ @
 inet_ntoa (* (struct in_addr *) & pd-> ip),
 htons (pd-> port));
 pd-> ps = PLAY_STATE;
 +
 bzero (& addr, sizeof (addr));
 +
 addr.sin_family = AF_INET;
 addr.sin_addr.s_addr = pd-> ip;
 addr.sin_port = pd-> port;
 +
 if (timed_connect (* fd, (struct sockaddr *) & addr, sizeof (addr))) {
 pd-> ps = DOWN_STATE;
 goto error1;
 }
 +
 pd-> ps = BUSY_STATE;
 return SUCCESS;
 error1:
 -641.7 +652.7 @ @ @ @
 dup2 (pipe_fd [1], 1);
 / / Dup2 (pipe_fd [1], 2);
 / / Putenv ("LD_PRELOAD =");
 - Execlp ("proxyresolv", "proxyresolv", name, NULL);
 Execlp + (". / Proxyresolv", "proxyresolv", name, NULL);
 perror ("can not exec proxyresolv");
 exit (2);
diff-run proxychains-3.1/proxychains/core.h proxychains-3.1_resolv/proxychains/core.h
 2006-03-15 10:16:59.000000000 -0600 --- proxychains-3.1/proxychains/core.h
 + + + 2011-06-16 13:17:19.000000000 -0500 proxychains-3.1_resolv/proxychains/core.h
 -66.29 +66.28 @ @ @ @
 proxychains_write_log int (char * str ,...);
 struct hostent * proxy_gethostbyname (const char * name);
+ Typedef struct hostent * (* gethostbyname_t) (const char *);
 + Static gethostbyname_t true_gethostbyname;
 typedef int (* connect_t) (int, const struct sockaddr *, socklen_t);
 -Connect_t true_connect;
 -
 -Typedef struct hostent * (* gethostbyname_t) (const char *);
 -Gethostbyname_t true_gethostbyname;
 + / / Connect_t true_connect;
 typedef int (* getaddrinfo_t) (const char *, const char *,
 const struct addrinfo *,
 struct addrinfo **);
 -Getaddrinfo_t true_getaddrinfo;
 + / / Getaddrinfo_t true_getaddrinfo;
 typedef int (* freeaddrinfo_t) (struct addrinfo *);
 -Freeaddrinfo_t true_freeaddrinfo;
 + / / Freeaddrinfo_t true_freeaddrinfo;
 typedef int (* getnameinfo_t) (const struct sockaddr *,
 socklen_t, char *,
 socklen_t, char *,
 socklen_t, unsigned int);
 -Getnameinfo_t true_getnameinfo;
 + / / Getnameinfo_t true_getnameinfo;
 typedef struct hostent * (* gethostbyaddr_t) (const void *, socklen_t, int);
 -Gethostbyaddr_t true_gethostbyaddr;
 + / / Gethostbyaddr_t true_gethostbyaddr;
 proxy_getaddrinfo int (const char * node, const char * service,
 const struct addrinfo * hints,
 diff-run proxychains-3.1/proxychains/libproxychains.c proxychains-3.1_resolv/proxychains/libproxychains.c
 2006-03-15 10:16:59.000000000 -0600 --- proxychains-3.1/proxychains/libproxychains.c
 + + + 2011-06-16 13:17:19.000000000 -0500 proxychains-3.1_resolv/proxychains/libproxychains.c
 -32.7 +32.6 @ @ @ @
 # Include
 # Include
-
 # Include "core.h"
 # Define satosin (x) ((struct sockaddr_in *) & (x))
 +56.13 -57.6 @ @ @ @
 unsigned int * proxy_count,
 chain_type * ct);
+ Connect_t true_connect;
 + Getaddrinfo_t true_getaddrinfo;
 + Freeaddrinfo_t true_freeaddrinfo;
 + Getnameinfo_t true_getnameinfo;
 + Gethostbyaddr_t true_gethostbyaddr;
 +
 +
 static void init_lib ()
 {
 / / Proxychains_write_log ("ProxyChains-" VERSION
 -291.7 +297.7 @ @ @ @
 int getnameinfo (const struct sockaddr * sa,
 socklen_t Salen, char * host,
 socklen_t hostlen, char * serv,
 - Servlen socklen_t, unsigned int flags)
 + Servlen socklen_t, int flags)
 {
 int ret = 0;
 if (! init_l)
 diff-run proxychains-3.1/proxychains/proxychains proxychains-3.1_resolv/proxychains/proxychains
 2006-03-15 10:16:59.000000000 -0600 --- proxychains-3.1/proxychains/proxychains
 + + + 2011-06-16 13:17:20.000000000 -0500 proxychains-3.1_resolv/proxychains/proxychains
 @ @ @ @ -1.9 +1.11
 #! / Bin / sh
 echo "ProxyChains-3.1 (http://proxychains.sf.net)"
 + Echo "Mod for OSX - using dylib"
 if [$ # = 0]; then
 echo "usage:"
 echo "proxychains [args]"
 exit
 fi
 -Export LD_PRELOAD = libproxychains.so
 + Export DYLD_FORCE_FLAT_NAMESPACE =
 DYLD_INSERT_LIBRARIES export + =. / .libs/libproxychains.3.0.0.dylib
 exec "$ @"
 diff-run proxychains-3.1/proxychains/proxyresolv proxychains-3.1_resolv/proxychains/proxyresolv
 2006-03-15 10:16:59.000000000 -0600 --- proxychains-3.1/proxychains/proxyresolv
 + + + 2011-06-16 13:18:51.000000000 -0500 proxychains-3.1_resolv/proxychains/proxyresolv
 -11.6 +11.6 @ @ @ @
 exit
 fi
-
 -Export LD_PRELOAD = libproxychains.so
 -Dig $ 1 @ $ DNS_SERVER + tcp | awk '/ A + [0-9] + \. [0-9] + \. [0-9] / {print $ 5;}'
 + Export DYLD_FORCE_FLAT_NAMESPACE =
 DYLD_INSERT_LIBRARIES export + =. / .libs/libproxychains.3.0.0.dylib
 Dig + $ 1 @ $ DNS_SERVER + tcp | awk'/^[^;].+ A. + [0-9] + \. [0-9] + \. [0-9] / {print $ 5;} '
 
3. Apply the patch
 
 patch-p0 <proxychains-3.1_osx.diff
 
4. Compile
 
 proxychains cd-3.1
 . / Configure - prefix = / opt / local
 cd proxychains
 Make
 sudo make install
 
5. Install links
 
 mkdir ~ /. libs
 mkdir ~ /. proxychains
 ln-s / opt/local/lib/libproxychains.3.0.0.dylib ~ /. libs /
 ln-s / opt / local / etc / proxychains.conf ~ /. proxychains /
 
6. Configure proxychains.conf of / opt / local / etc / proxychains.conf, the default configuration to use Tor (socks4 127.0.0.1 9050)
7. Stay deh pake
To be more secure, in proxychains.conf there is to resolv DNS configuration via proxy as well.
 
 # Proxy DNS requests - no leak for DNS data
 proxy_dns
 
Somehow, proxychains for MacOS is still an error if the feature is activated.

 $ Proxychains lynx http://www.google.com
 ProxyChains-3.1 (http://proxychains.sf.net)
 Mod for OSX - using dylib
 
Looking up www.google.com|DNS-request | www.google.com
 proxyresolv can not exec: No such file or directory
 | DNS-response |: www.google.com is not exist
 Alert!: Unable to connect to remote host.
 
So we can choose to disable the feature is to risk our existence can be detected via DNS request. But if you want to use the feature is most easily run their own solutions proxyresolv program,

 $ Proxyresolv www.google.com
 | S-chain | - 127.0.0.1:9050 - 4 .2.2.2:53 - OK
 74,125,224,147
 74,125,224,148
 74,125,224,144
 74,125,224,145
 74,125,224,146
 
After that browsing via IP,

 $ Proxychains lynx http://74.125.224.147
 ProxyChains-3.1 (http://proxychains.sf.net)
 Mod for OSX - using dylib
 
 Google
 
 
 
 
 Videos Web Images Maps News Shopping Gmail more
 Settings | Sign in
 _________________________________________________________
 Google Search I'm Feeling Lucky searchLanguage Advanced tools
 Advertising ProgramsBusiness SolutionsAbout GoogleGo to Google.com
 2011 - Privacy
(Textarea) Enter text. Use UP / DOWN arrows or TAB to move off.1 :9050 - 74 .125.224.147:80 - OK
 TransfeEnter data into the text field by typing on the keyboard
 
Temporary solution. More males are looking for do not know why the feature is still error. Have phun!
! UPDATE!!
Just read his little patch and noticed there is this section:
 
 -641.7 +652.7 @ @ @ @
 dup2 (pipe_fd [1], 1);
 / / Dup2 (pipe_fd [1], 2);
 / / Putenv ("LD_PRELOAD =");
 - Execlp ("proxyresolv", "proxyresolv", name, NULL);
 Execlp + (". / Proxyresolv", "proxyresolv", name, NULL);
 perror ("can not exec proxyresolv");
 exit (2);
 
Fewer know why but patch above assume "proxyresolv" accessible from the current directory. For who would run it proxychains from the source directory does not matter, but klo for the use "make install" will certainly be a problem.For that, we can remove part of the above-3.1_osx.diff proxychains so that its results will be compiled later to walk normally and proxyresolv can be used automatically.

 $ Proxychains lynx http://www.google.com
 ProxyChains-3.1 (http://proxychains.sf.net)
 Mod for OSX - using dylib
 
Looking up www.google.com|DNS-request | www.google.com
 | S-chain | - 127.0.0.1:9050 - 4 .2.2.2:53 - OK
 | DNS-response | www.google.com is 209.85.148.105
 Making HTTP connection to www.google.com|S-chain|--127.0.0.1:9050--209.85.148.105:80--OK
 
... Or for the SSH connection

 $ Proxychains ssh root@team.infosec-id.com
 ProxyChains-3.1 (http://proxychains.sf.net)
 Mod for OSX - using dylib
 | DNS-request | xxx.infosec-id.com
 | S-chain | - 127.0.0.1:9050 - 4 .2.2.2:53 - OK
 | DNS-response | team.infosec-id.com is 205.185.x.x
 | S-chain | - 127.0.0.1:9050 - 205 .185. X.x :22 - OK
 Linux byteskrew xxxxxxxxxxx # 3 SMP Tue Jun 3 16:37:31 PDT 2011 i686 GNU / Linux
 10.04.1 LTS Ubuntu


Tidak ada komentar:

Posting Komentar