Jump to content

New Project


Doxie
 Share

Recommended Posts

Intresting title.. eeh

Well, i got a new project, wich i belive i would be able to make.

But to make this intresting, i will announce my project and make it open for everyone to partisipate.

I got this idea after reading a couple of post, where people asked if there is anything they can help with. After all, trial and error is the best way to learn (for me atleast).

Please keep the flaming to PM only, after all this is a support post :idiot:

Config of ADSL modem

I got 120 ADSL modem that need to be reconfigured.

This can be done with a CD, but i thought it would be more fun to do it with AutoIt.

What i found out so far, is that the config file of the modem, is located in a subfolder called DL and is called user.ini. I can access this file by using FTP.

I have now created a new user.ini for all the modems, but the file need some user information and also be uploaded to the modem by the user.

1) GUI/Inputbox that will prompt for the Username and Password (Confirm password)

2) Iniwrite the Username and Password to user.ini (case sensitive)

3) Upload the user.ini file to the modem (IP:192.168.0.254/DL)

This has to be done with no admin rights or the use of RunAsSet.

Modification of the user.ini file:

[ env.ini ]

set var=PPPoE_userid value=""

set var=PPPoE_passwrd value=""

If you found this to be a intresting project, don't hasitate to ask me for more information.

Were ever i lay my script is my home...

Link to comment
Share on other sites

Maybe I am missing something, or maybe I am just out of it, or maybe I'm not, but I am not seeing why this would be an 'open project' everything you described here seems like it should be pretty easy as you have layed everything out, all you have to do is code it in.

So... whats up? You want help, or what?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Slim>

1) Its not uploaded to a FTP server, its uploaded to their modem using FTP.

2) Before we start to use the new settings, i will make a "push" using the login script. So when the new settings should be used, i can tell the users to just click on the au3 file.

JS>

I agree with you, it might seems like its all layed up. Sorry for that.

What i tried to describe above is just the procedure that needs to be done. Not how its done. But after all, yea you are probably right, its mostly scripting. The changes i can think of right now, is the GUI for the username and password. :/

Anyway, alot of scripts that does the samething looks different.

And i belive project like this can be usefull for everyone.

For example, one user come up with a working ftp send, while another user look at the command, and recommend to add something extra to it.

After all, this might been a stupid idea. :idiot:

Were ever i lay my script is my home...

Link to comment
Share on other sites

Maybe I am missing something, or maybe I am just out of it, or maybe I'm not, but I am not seeing why this would be an 'open project' everything you described here seems like it should be pretty easy as you have layed everything out, all you have to do is code it in.

So... whats up? You want help, or what?

JS

<{POST_SNAPBACK}>

I think he wants us to do all the coding :idiot:
Link to comment
Share on other sites

Slim>

1) Its not uploaded to a FTP server, its uploaded to their modem using FTP.

2) Before we start to use the new settings, i will make a "push" using the login script. So when the new settings should be used, i can tell the users to just click on the au3 file.

JS>

I agree with you, it might seems like its all layed up. Sorry for that.

What i tried to describe above is just the procedure that needs to be done. Not how its done. But after all, yea you are probably right, its mostly scripting. The changes i can think of right now, is the GUI for the username and password. :/

Anyway, alot of scripts that does the samething looks different.

And i belive project like this can be usefull for everyone.

For example, one user come up with a working ftp send, while another user look at the command, and recommend to add something extra to it.

After all, this might been a stupid idea. :lol:

<{POST_SNAPBACK}>

Nah the idea isnt stupid. Dont take my question that way. I was just wanting to know the purpose. I actually want to know how to FTP, I know there are command line programs, but I like using self contained stuff :D.

As far as the GUI goes you dont need a GUI just use the InputBox(). That is enough to do what you want unless you want some kind of special buttons and images and gfx on there.

I think he wants us to do all the coding :idiot:

<{POST_SNAPBACK}>

It does seem that way. Though from everything he has explained I dont think there is that much to code. Relatively easy.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I think he wants us to do all the coding :D

<{POST_SNAPBACK}>

Sorry for making it look like that. It was not my idea with this.

I just thought it would be fun to start a small project and see everyones process.

As i said above, this was a stupid idea, and i will make the script myself, and later show you guys how i did it. And maybe then you can add comments.

Once again sorry for trying to be a leech.

:idiot:

Were ever i lay my script is my home...

Link to comment
Share on other sites

Sorry for making it look like that. It was not my idea with this.

I just thought it would be fun to start a small project and see everyones process.

As i said above, this was a stupid idea, and i will make the script myself, and later show you guys how i did it. And maybe then you can add comments.

Once again sorry for trying to be a leech.

:idiot:

<{POST_SNAPBACK}>

If you are as you say, then you werent trying to be a leech and there is no reason for an apology. Dont beat yourself up so much.

The best way is to write the script yourself then ask everyone to comment and stuff. I certainly dont mind doing that for ya. I know in the Scripts and Scraps section people do that all the time.

Please do let us know how this goes, and let us know if you need any help, as we would be more than willing to help in any way we can.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Ok, i have come to the point when i need help :D

;Creates Modem.txt file
$file = FileOpen("Modem.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Please contact Local IT.")
    Exit
EndIf

FileWriteLine($file, "User none")
FileWriteLine($file, "cd dl")
FileWriteLine($file, "lcd c:\Options")
FileWriteLine($file, "binary")
FileWriteLine($file, "mput user.ini")
FileWriteLine($file, "quit")
FileClose($file)

User()
Pass()
Connect()
Func User()
Global $user = InputBox("Username", "Enter your username.", "", "")
EndFunc
Func Pass()
Global $passwd = InputBox("Password", "Enter your password.", "", "*")
Global $passwd1 = InputBox("Confirm Password", "Enter your password again.", "", "*")
If $passwd == $passwd1 Then
   MsgBox(4096, "Test", $user)
   Connect()
Else
   MsgBox(4096, "Wrong Password", "The Passwords you typed do not match.")
   Pass()
EndIf
EndFunc
Func Connect()
   IniWrite("user.ini", "env.ini", "set var=PPPoE_userid value", $user)
   IniWrite("user.ini", "env.ini", "set var=PPPoE_passwrd value", $passwd1)
   RunWait(@COMSPEC & " /c c:\windows\system32\ftp.exe -n -i -s:c:\Options\Modem.txt 192.168.0.254")
EndFunc
FileDelete($file)

As you can see above my iniwrite value got a = in it, wich mezz everything up.

Cause if i run it twice, it will not overwrite the line, but instead add a new line in the ini file.

If User is Donald the iniwrite would be:

set var=PPPoE_userid value=Donald

If i then run it again with user Duck it would add a new line.

set var=PPPoE_userid value=Duck

I belive the one in red is the problem, right?

Can someone please help, before i go nuts here :idiot:

EDIT: Changed the code the latest.

Edited by Doxie

Were ever i lay my script is my home...

Link to comment
Share on other sites

Shady, the "=" is not my idea :idiot:

It has to be like that to be used by the modem.

Edit:

I also noticed that it write all the ini stuff twice :D

When i run the file once, it looks like this:

set var=PPPoE_userid value=Donald

set var=PPPoE_passwrd value=Duck

set var=PPPoE_userid value=Donald

set var=PPPoE_passwrd value=Duck

And if i run it again (without deleting the ini file)

It would look like this:

set var=PPPoE_userid value=Donald

set var=PPPoE_passwrd value=Duck

set var=PPPoE_userid value=Donald

set var=PPPoE_passwrd value=Duck

set var=PPPoE_userid value=Donald

set var=PPPoE_passwrd value=Duck

set var=PPPoE_userid value=Donald

set var=PPPoE_passwrd value=Duck

Edited by Doxie

Were ever i lay my script is my home...

Link to comment
Share on other sites

1. You write to an INI file called "user.ini but I don't see it in the RunWait function.

2. Maybe you could delete the file when the user enters an incorrect password so it doesn't add a new line.

If that's unacceptable, you could FileCopy the INI file to a safe place.

And choose not to overwrite, so it copies only once.

And each time the script is ran, you FileCopy the copied file to the right place.

So it doesn't contain multiple lines, and the original settings are preserved.

My version is attached. The things I said above are not included.

I just improved the script.

<attachment removed>

Edited by SlimShady
Link to comment
Share on other sites

1. You write to an INI file called "user.ini but I don't see it in the RunWait function.

2. Maybe you could delete the file when the user enters an incorrect password so it doesn't add a new line.

If that's unacceptable, you could FileCopy the INI file to a safe place.

And choose not to overwrite, so it copies only once.

And each time the script is ran, you FileCopy the copied file to the right place.

So it doesn't contain multiple lines, and the original settings are preserved.

My version is attached. The things I said above are not included.

I just improved the script.

<{POST_SNAPBACK}>

1) In RunWait you can see i call Modem.txt, and at the top of the script you can see i create a file called Modem.txt (only FTP commands) and then it upload the user.ini

2) The file i got is containing alot more then user/pass, so just deleting the file would not work. Or maybe.

This might work:

1) Use login script to push Au3 + User.ini file

2) When they run Au3, make a copy of User.ini

3) Write the User/Password to the copy

4) If wrong Password, delete copy And start from 2) again.

But the question is, how will it handle the original user.ini file, that already contain:

set var=PPPoE_userid value=""

set var=PPPoE_passwrd value=""

Will it add the value or just create two new lines in the user.ini file?

Were ever i lay my script is my home...

Link to comment
Share on other sites

I guess its Alcatel, the company that is making Speedtouch modem. :idiot:

Edit:

I could not attach .ini file, so i just copy/paste the whole file here.

[ env.ini ]
set var="CONF_REGION" value="Sweden"
set var="CONF_PROVIDER" value="Övriga"
set var="CONF_DESCRIPTION" value="Övriga ISP`er (Internet Service Provider) som levererar ADSL tjänst med PPPoE inlogging (Ditt användarnamn@Din ISP.se) ex Spray, Telenordia, Glocalnet, Tiscali, Tele 2, Bostream, Rixtelecom, mm"
set var="CONF_SERVICE" value="ADSL med PPPoE inloggining"
set var="CONF_DATE" value="29 Dec 2004"
set var="CONF_VERSION" value="3.7.1.5"
set var="HOST_SETUP" value="auto shortcut"
set var="DSL_ADDR" value="8*35"
set var="PPPoE_userid" value="test"
set var="PPPoE_passwrd" value="password"
set var="PPPoE_serviceid" value="Glocalnett"
set var="HOST_MAC_ADDR" value="00-08-02-E9-2E-29"
set var="HOST_IP_ADDR" value="<dhcp>"
set var="HOST_NET_MASK" value="<dhcp>"
set var="HOST_GATEWAY" value="<dhcp>"
set var="HOST_DNS" value="<dhcp>"
set var="HOST_NAME" value="XPPIT3"
set var="ST_LAN_IP_ADDR" value="192.168.0.254"
set var="ST_LAN_NET_MASK" value="255.255.255.0"

[ phone.ini ]
add name="pppoe" addr=8*35 type=pppoa

[ qos.ini ]
add name="default" class=ubr

[ oam.ini ]
config clp=1

[ bridge.ini ]
config age=300

[ pptp.ini ]

[ dhcp.ini ]
config autodhcp=off scantime=20 spoofing=off trace=off
policy verifyfirst=off trustclient=on
spoof failtime=4 errorlt=60 dodlt=10
pool add name="LAN_private"
pool config name=LAN_private poolstart=192.168.0.1 poolend=192.168.0.253 netmask=24 leasetime=7200
start

[ mer.ini ]

[ ipoa.ini ]

[ ppp.ini ]
ifadd intf="pppoe"
rtadd intf=pppoe dst=0.0.0.0/0 src=192.168.0.0/24 metric=1
ifconfig intf=pppoe dest=pppoe proto=pppoe servicename="Glocalnett" encaps=llc accomp=on addrtrans=pat
ifconfig intf=pppoe user="test" password=_DEV_EF4A377BCAAF7D89 status=up

[ cip.ini ]

[ pfilter.ini ]

[ pfirewall.ini ]
chain create chain="source"
chain create chain="forward"
chain create chain="sink"
rule create chain=source index=0 dstintfgrp=!wan action=accept
rule create chain=source index=1 prot=udp dstport=dns action=accept
rule create chain=source index=2 prot=udp dstport=bootps action=accept
rule create chain=source index=3 action=drop
rule create chain=forward index=0 srcintfgrp=wan dstintfgrp=wan action=drop
rule create chain=sink index=0 srcintf="eth0" srcbridgeport=1 action=accept
rule create chain=sink index=1 srcintfgrp=!wan action=accept
rule create chain=sink index=2 prot=udp dstport=dns action=accept
rule create chain=sink index=3 prot=udp dstport=bootpc action=accept
rule create chain=sink index=4 action=drop
assign  hook=sink chain="sink"
assign  hook=forward chain="forward"
assign  hook=source chain="source"

[ ip.ini ]
config forwarding=on firewalling=on redirects=on sourcerouting=off netbroadcasts=off ttl=64 fraglimit=64 defragmode=nat addrcheck=static mssclamping=on
apadd addr=192.168.0.254/24 intf=eth0 addroute=no
ifconfig intf=loop mtu=1500 group=local
ifconfig intf=eth0 mtu=1500 group=lan
ifconfig intf=pppoe mtu=1492 status=down group=wan
rtadd dst=0.0.0.0/0 intf=eth0 metric=70
rtadd dst=224.0.0.0/4 intf=eth0
rtadd dst=192.168.0.0/24 gateway=192.168.0.254
rtadd dst=255.255.255.255/32 gateway=192.168.0.254
rtadd dst=192.168.0.0/24 src=192.168.0.0/24 gateway=192.168.0.254

[ autoip.ini ]
ifadd intf=eth0
ifconfig intf=eth0 addr=169.254.112.178 poolstart=169.254.1.1 poolend=169.254.254.254 netmask=16
ifattach intf=eth0

[ eth.ini ]
ifconfig intf= type=

[ dnsd.ini ]
domain domain="lan"
add hostname="SpeedTouch"
start
troff

[ dhcc.ini ]
config trace=off

[ adslpots.ini ]
config opermode=multimode maxbitspertoneUS=13

[ upnp.ini ]
config maxage=1800

[ nat.ini ]
bind application=RAUDIO(PNA) port=realaudio
bind application=IRC port=irc-u
bind application=RTSP port=rtsp
bind application=FTP port=ftp
bind application=H323 port=h323

[ system.ini ]
config upnp=enabled mdap=enabled dcache=enabled

[ endofarch ]
Edited by Doxie

Were ever i lay my script is my home...

Link to comment
Share on other sites

This one is working much better:

IniWrite("user.ini", "env.ini", "set var", "PPPoE_userid value=" & $username)

Exept that i can't have to line look like that.

Edit:

And delete the first line in the .ini file :idiot:

Edited by Doxie

Were ever i lay my script is my home...

Link to comment
Share on other sites

I've managed to retrieve the MAC Address using AutoIt and a batch file.

Here it is:

$MAC_addr = _GetMAC()
MsgBox(64, "Test", "MAC address: " & $MAC_addr)

Func _GetMAC()
   Local $IniFile
   $IniFile = @TempDir & "\SysInfo.ini"
   If NOT FileExists(@TempDir & "\SysInfo.bat") Then
      Local $OpenBatch
      $OpenBatch = FileOpen(@TempDir & "\SysInfo.bat", 2)
         FileWriteLine($OpenBatch, '@ECHO OFF')
         FileWriteLine($OpenBatch, 'SET INIFILE=%TEMP%\SysInfo.ini')
         FileWriteLine($OpenBatch, 'ECHO [SystemInfo]> %INIFILE%')
         FileWriteLine($OpenBatch, 'FOR /F "tokens=1,2 delims=:" %%I IN (''IPCONFIG /ALL ^| FIND /I "physical"'') DO SET MAC=%%J')
         FileWriteLine($OpenBatch, 'SET MAC=%MAC:~1,-1%')
         FileWriteLine($OpenBatch, 'ECHO MacAddr=%MAC%>> %INIFILE%')
      FileClose($OpenBatch)
   EndIf
   RunWait(@TempDir & "\SysInfo.bat", @SystemDir, @SW_HIDE)
   Return INIRead($IniFile, "SystemInfo", "MacAddr", "")
EndFunc

Now I know how your ini file looks like, I updated the script.

I don't think it will work using INIRead/INIWrite, so you'll have to use FileRead, FileWrite.

Edited by SlimShady
Link to comment
Share on other sites

Exellent, that one is working perfectly.

The script is almost finished now.

There is a small chance it can be a mezz, but i have to convince everyone here at the IT dep that its not "that" big chance :idiot:

Edit:

I downloaded your last script, and i can't see that you used FileWrite/Read?

I attach the one i'm working on.

modem1.au3

Edited by Doxie

Were ever i lay my script is my home...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...