DO NOT DEAL WITH THIS MEMBER
Seriously, We need more of these threads. Why is this so hard to find other threads about this because I have been searching for more tuts about this for nearly 3 hours straight.
My result: Fail
Thanks for sharing the source code mate, Keep It Up.
this a very nice...
thx to tutorial...
This is very nice any chance of the source for how to do in vb6?
(Feb 19, 2010 05:42 PM)King Flawless Wrote: This is very nice any chance of the source for how to do in vb6?
char HostsFile[256]; or HostsFile BYTE 260 dup(?) This will basically turn into a pointer to the bytes (array) that is viewable in the hex dump.
Honestly no clue in VB6, just use a file stream and stuff... Here's how it's done in assembler and C++... I am sure you can easily import the functions I am using and just use a simple file io.
Assembler:
Code .386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\msvcrt.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\msvcrt.lib
fopen PROTO C :DWORD, :DWORD
fprintf PROTO C :DWORD, :DWORD, :VARARG
fflush PROTO C :DWORD
fclose PROTO C :DWORD
.DATA
extPath db "\System32\drivers\etc\hosts", 00h
HostsWrite db "127.0.0.1 www.google.ca", 13, 10 ;CR LF (carrage return linefeed)
db "127.0.0.1 google.ca", 00h ;end of string null terminated
strWINDIR db "WINDIR", 00h
xAB db "ab", 00h
xfprintf db "%s", 00h
.DATA?
HostsPath BYTE 260 dup(?) ;buffer for hosts file
hFile DWORD ?
.CODE
start: ;entry point
push 260
lea edx, HostsPath
push edx
push offset strWINDIR
call GetEnvironmentVariable
lea edx, HostsPath
push edx
push offset extPath
call lstrcat
lea edx, HostsPath
push edx
call GetFileAttributes
cmp eax, -1 ;attributes returned in eax, if its -1 that means file does not exist
push eax
call ExitProcess
jnz _writeFile
_writeFile:
push offset xAB
lea edx, HostsPath
push edx
call fopen
add esp, 2*4
mov hFile, eax ;handle returned into eax
push offset HostsWrite
push offset xfprintf
push hFile
call fprintf
push hFile
call fflush
push hFile
call fclose
push eax
call ExitProcess
end start
C++:
Code #include <windows.h>
#include <stdio.h>
HANDLE hFile;
int main()
{
char fileWrite[] = "\n127.0.0.1 www.google.ca\n127.0.0.1 google.ca";
char HostsPath[256]; //Yeah, I know I did 260 in assembler, made a typo and i dont feel like fixing it...
GetEnvironmentVariable("WINDIR", HostsPath, 256);
lstrcat(HostsPath, "\\System32\\drivers\\etc\\hosts");
if( GetFileAttributes(HostsPath) != -1 ) //checking if exists
{
hFile = fopen(HostsPath, "ab");
if( hFile != NULL ) // didn't check for this in assembler, didnt feel like typing too much (null = 0)
}
fprintf(hFile, "%s", fileWrite);
fflush(hFile);
fclose(hFile);
}
return 0;
PS: This was done in notepad... so their might be errors
for VB6, google file streams and just import the functions that I am using.
I have better way...
1st create a copy of host on notepad and add the host u wanna block...then make a sfx archive using winrar...put the host file in the archive and make it extract direct to the file that contain the original host...
Its Works great for me...
No that way is not better because it takes multiple files.
This will not work on Windows 7 or any Windows Vista with the UAC in effect. The program will throw a System Access Exception. I have not found a way in C# to get around this yet, but when I do, I will let you know. Reading from the host file can be done, haven't found how to alter it.
(Mar 4, 2010 06:37 PM)n00bSaibot Wrote: This will not work on Windows 7 or any Windows Vista with the UAC in effect. The program will throw a System Access Exception. I have not found a way in C# to get around this yet, but when I do, I will let you know. Reading from the host file can be done, haven't found how to alter it. In C#, You Could Have It Edit The UAC Registry Key To Disable And Auto-Restart The Computer For It To Take Effect. (Make Sure You Have A Manifest File So It Will Auto-Run As Admin)
Much better ways of doing this... Such as hijacking winsock functions and etc.
Or making IE or FireFox connect to a proxy that denies certain websites. (Very easy to do with winsock)
PLZ HELP MEEe! I want a ((javascript code)) to editing hosts file !!!....
Sorry for my pure English!!
(Mar 12, 2010 02:49 AM)farzin0123 Wrote: PLZ HELP MEEe! I want a ((javascript code)) to editing hosts file !!!....
Sorry for my pure English!!
You cant do that in javascript.
nice code thanks 😎
Have nice day 🤝
Have Fun Cya 🤗
Mar 15, 2010 07:23 PM
(This post was last modified: Mar 15, 2010 07:34 PM by High Definition.)
Looks good..Must be used in crypters to redirect virustotal.com to nvt ...:D
wait can some1 help me i think this is the problem y i cant connect 2 ddoser 3.4 cracks can some1 tell me how to fix the prob pleaz
|