Sign in to follow this  
Followers 0
GrungeRocker

HOST data

7 posts in this topic

Hi i need to update my HOST-File every day and i thought, wy shouldn't autoit do this...

but i have a prob.

i only wanna 4 lines to be updated and the others should be normal....

how is this possible?

the host-file:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# Dies ist eine HOSTS-Beispieldatei, die von Microsoft TCP/IP
# für Windows 2000 verwendet wird.
#
# Diese Datei enthält die Zuordnungen der IP-Adressen zu Hostnamen.
# Jeder Eintrag muss in einer eigenen Zeile stehen. Die IP-
# Adresse sollte in der ersten Spalte gefolgt vom zugehörigen
# Hostnamen stehen.
# Die IP-Adresse und der Hostname müssen durch mindestens ein
# Leerzeichen getrennt sein.
#
# Zusätzliche Kommentare (so wie in dieser Datei) können in
# einzelnen Zeilen oder hinter dem Computernamen eingefügt werden,
# aber müssen mit dem Zeichen '#' eingegeben werden.
#
# Zum Beispiel:
#
#     102.54.94.97   rhino.acme.com       # Quellserver
#      38.25.63.10   x.acme.com           # x-Clienthost

127.0.0.1      localhost
84.137.129.139 L2authd.lineage2.com
84.137.129.139 nprotect.lineage2.com
84.137.129.139 update.nprotect.com
84.137.129.139 update.nprotect.net

lines that shoud be updated:

84.137.129.139 L2authd.lineage2.com
84.137.129.139 nprotect.lineage2.com
84.137.129.139 update.nprotect.com
84.137.129.139 update.nprotect.net

[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites



Pseudocode idea:

Inetget (or whatever method is best) the file

Save the file to Orig.txt

_FileReadToArray Orig.txt

For $i = 1 to $Array[0] - 4

Get line and write to new.txt

next

change last 4 lines in $array

write those new lines to new.txt

Upload new.txt as whatever the filename needs to be.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hmmmmm yes..... well thx that should work :o

Edited by Analritter

[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

maybe something like

Dim $host_file = "hostfile.txt"
Dim $new_data1 = "84.137.129.139 L2authd.lineage2.com"
Dim $new_data2 = "84.137.129.139 nprotect.lineage2.com"
Dim $new_data3 = "84.137.129.139 update.nprotect.com"
Dim $new_data4 = "84.137.129.139 update.nprotect.net"

Dim $backup_file = "hostfile-" & @YEAR & "_" & @MDAY & "_" & @MON & "_" & @HOUR & "_" & @MIN & ".bak"

Dim $Host_data = "# Copyright (c) 1993-1999 Microsoft Corp." & @CRLF & _
"#" & @CRLF & _
"# Dies ist eine HOSTS-Beispieldatei, die von Microsoft TCP/IP" & @CRLF & _
"# für Windows 2000 verwendet wird." & @CRLF & _
"#" & @CRLF & _
"# Diese Datei enthält die Zuordnungen der IP-Adressen zu Hostnamen." & @CRLF & _
"# Jeder Eintrag muss in einer eigenen Zeile stehen. Die IP-" & @CRLF & _
"# Adresse sollte in der ersten Spalte gefolgt vom zugehörigen" & @CRLF & _
"# Hostnamen stehen." & @CRLF & _
"# Die IP-Adresse und der Hostname müssen durch mindestens ein" & @CRLF & _
"# Leerzeichen getrennt sein." & @CRLF & _
"#" & @CRLF & _
"# Zusätzliche Kommentare (so wie in dieser Datei) können in" & @CRLF & _
"# einzelnen Zeilen oder hinter dem Computernamen eingefügt werden," & @CRLF & _
"# aber müssen mit dem Zeichen '#' eingegeben werden." & @CRLF & _
"#" & @CRLF & _
"# Zum Beispiel:" & @CRLF & _
"#" & @CRLF & _
"#    102.54.94.97   rhino.acme.com       # Quellserver" & @CRLF & _
"#     38.25.63.10   x.acme.com           # x-Clienthost" & @CRLF & @CRLF & _
"127.0.0.1     localhost" & @CRLF & _
$new_data1 & @CRLF & _
$new_data2 & @CRLF & _
$new_data3 & @CRLF & _
$new_data4 & @CRLF

FileMove ($host_file, $backup_file)
FileWrite($host_file, $Host_data)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

why not look at _FileWriteToLine in my sig?

:o

~cdkid


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I'm curious as to what legitimate needs you would be pointing German IP addresses to South Korean DNS entries?

Quote from the nprotect website:

nProtect is a new conceptweb-based anti-hacking & anti virus utility tool designed to protect PCterminals from being infected by viruses or hacking tools. It helps to ensure that all information entered into thePCterminals from being infected by viruses or hacking tools.

It helps to ensure that all information entered into the PC terminals during web access will not fall into the hands of hackers.

Edited by Confuzzled

Share this post


Link to post
Share on other sites

You are probably not a Lineage II player, that's why you say that. :D

Changing these entries in the HOSTS file is a common practice for players that want to bypass the connectivity to the official game server and use other private (and free) servers to play.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0