Académique Documents
Professionnel Documents
Culture Documents
Main Page Community portal Current events Recent changes Random page Help Donations
Useful Scripts
From DD-WRT Wiki
You are here: DD-WRT wiki mainpage / Scripting / Useful Scripts Certain scripts can enhance the function of your router with DD-WRT, giving it more features or customizing it towards your needs. To find out how to load scripts onto the router, see Startup Scripts.
Contents
1 Modifying $PATH at Startup 2 LED Scripts 3 Miscellaneous Scripts 3.1 Backup settings and restore them 3.2 Clear ttraff (WAN bandwidth graph) nvram data 3.2.1 The other way (NEW, 2012) 3.3 Compress the Firewall Script (to reduce nvram usage) 3.4 Web Server Wake-up 3.5 Auto Random MAC Address 3.6 Wireless Network Scanner (awk -f scanner) 3.7 Wireless Network Scanner (working on DD-WRT v24) 3.8 Name-based WOL (wake.sh) 3.9 Name-based WOL with dnsmasq 3.10 Automatic Connection Repair (always_on.sh) 3.11 Modifying $PATH Manually (path.sh) 3.12 View Logfile in Browser without Local Syslogd (log.sh) 3.12.1 First Method: Script Generated Live-content 3.12.2 Second Method: Static Generated HTML
www.dd-wrt.com/wiki/index.php/Useful_Scripts 1/27
2/15/13
3.13 Speak Your Signal Strength 3.14 Small Security Script (Firewall) 3.15 Secure remote management for a WAP 3.16 Directory Listing for DD-WRT Micro 3.17 Reset Wireless Radio 3.18 Display Connection Counts Per IP 3.18.1 For local IP's 3.18.2 Foa all IP's 3.19 L2TP Fix for HOT users (obsolete) 3.20 Email Bandwidth Usage Daily 3.21 Update Allowed Remote IP Range by DNS lookup 3.22 Other Useful Misc. Scripts 4 See Also
If you're adding /mmc/lib before the system library, in some circumstances you'll also need to do this on startup (after ensuring that the ldconfig on /mmc is up to date and happy):
mut-bn /m/t/ds.of/t/ds.of on -id mcecl.ocn ecl.ocn mut-bn /m/t/ds.ah /t/ds.ah on -id mcecl.occe ecl.occe
Note: Only do this if you're receiving segmentation faults or your applications are failing to run, and even then only if you feel that this hack is imperative. Also note that if you're attempting this with Optware, the files are ldopt.so.conf and ld-opt.so.cache Another alternative to the above mentioned way of altering things is to simply copy /etc/profile to /jffs/etc, change PATH and LD_LIBRARY_PATH and bind the profile to the original location.
mdr/fsec ki jf/t c /t/rfl /fsecpoie p ecpoie jf/t/rfl c /fsec d jf/t v poie(hneeeyhnsta sieyu nesadsv i wt :) i rfl cag vrtig ht ut or ed n ae t ih x
2/15/13
Make sure you're familiar with what you're doing before attempting this, if you end up seeing a lot of segmentation faults when running things like ls, cat, cp, etc, than you'll want to either adjust the above commands, or else put those things into a script and run them manually when you enter your shell.
LED Scripts
See LED Scripts
Miscellaneous Scripts
Backup settings and restore them
Credit to hardwarewizard and frater Reference Thread (http://www.dd-wrt.com/phpBB2/viewtopic.php?t=44324)
#/i/h !bns ############################# ############################ # Srp Rqieet cit eurmns # # Fls ie: # vr_osi ast_kp # vr_rfre aspeerd # # Porm: rgas # cr ul ############################# ############################ ############################# ############################ #stpvrals eu aibe # #DT AE -Dt ae #MC A -Mcades a drs #FL IE -Fl Nm Pei ie ae rfx #CRDR U_I -CretDrcoy urn ietr #tase rnfr -FPTase O/F (eal i OF T rnfr NOF Dfut s F) #FLE ODR -Lcto weebcu srpsaesoe oain hr akp cit r trd #VRIE AFL -Lcto &Nm o Tm Fl oain ae f ep ie #T_L OAL -Lcto &Nm o srp Fl wt alnrmvrals oain ae f cit ie ih l va aibe #T_NLD OICUE -Lcto &Nm o srp Fl wt esnilnrmvrals oain ae f cit ie ih seta va aibe #T_XLD OECUE -Lcto &Nm o srp Fl wt dneosnrmvrals oain ae f cit ie ih agru va aibe #T_RFRE OPEERD -Lcto &Nm o srp Fl wt peerdnrmvrals oain ae f cit ie ih rfre va aibe # ############################# ############################ DT=dt +mdY AE`ae %%%` MC`va gtlnhad |t - "" A=nrm e a_wdr r d :` FL={A}$DT} IE$MC.{AE CRDR`inm $` U_I=drae 0 tase= rnfr0 FLE=otvr/akp ODR/p/asbcus
www.dd-wrt.com/wiki/index.php/Useful_Scripts 3/27
2/15/13
VRIE/p/m/l_as AFL=ottpalvr T_L={ODR/{A}$DT}als OAL$FLE}$MC.{AE.l.h T_NLD={ODR/{A}$DT}esnils OICUE$FLE}$MC.{AE.seta.h T_XLD={ODR/{A}$DT}dneoss OECUE$FLE}$MC.{AE.agru.h T_RFRE={ODR/{A}$DT}peerds OPEERD$FLE}$MC.{AE.rfre.h ############################# ############################ #T Lgnifraincag t yu if FP oi nomto hne o or no ############################# ############################ FP=t:/9.6..0/akp TSfp/1218110bcus UEPS=srps SRASue:as ############################# ############################ #ra cmadln sice ed omn ie wths # # eapecmadlns xml omn ie # # .bcuvr.h/akpass t # # Teaoecmadwt ueteue adpswr ad h bv omn ih s h sr n asod n # sre ifrainebde i ti srp. evr nomto medd n hs cit # (e FPLgnifrainaoe Se T oi nomto bv) # # # .bcuvr.h- - ue:as- fp/1218110bcus /akpass t u srps f t:/9.6..0/akp # # Teaoecmadwt ueteue adpswr ad h bv omn ih s h sr n asod n # sre ifrainfo tecmadln evr nomto rm h omn ie # ############################# ############################ wiegtpst::nm hl eot uf ae d o cs $aei ae nm n t ) tase=; rnfr1; u ) UEPS=$PAG; SRAS"OTR"; f ) FP=$PAG; TS"OTR"; ? ) pit "sg:%:[t [uuenm:asod [ffpevr\" rnf Uae s -] sraepswr] tsre]n ei 2; xt ; ea sc dn oe sit$(OTN -1) hf ($PID ) ############################# ############################ #raeNRMvraels adwiet /p/m/l_as cet VA ail it n rt o ottpalvr ############################# ############################
nrmso 2/e/ul|erp'[-az[-az-_.-*'|ak- ='pit$} |sr - - >{A va hw >dvnl ge ^AZ-]AZ-09\\]= w F {rn 1' ot r u $VR ############################# ############################ #Wiehae t rsoesrps rt edr o etr cit ############################# ############################
eh - "!bns\#nco\Wievrals"n |te- $T_XLD}|te- $T_RFRE}|te co e #/i/hn\eh "rt aibe\\" e i {OECUE e i {OPEERD e ############################# ############################ #sa NRMvral ls adsn vral t poe cn VA aibe it n ed aibe o rpr #rsoesrp etr cit ############################# ############################ ct$VRIE |wiera vr a {AFL} hl ed a d o pe= rf0 ##rpae wt nx ln b AdnMne : i eh "{a} |ge - - "{U_I}vr_osi" # elcd ih et ie y no av f co $vr" rp q f $CRDR/ast_kp
www.dd-wrt.com/wiki/index.php/Useful_Scripts 4/27
2/15/13
i ct"{U_I}vr_osi"|ge - "{a} f a $CRDR/ast_kp rp q $vr" ;te hn bie$OECUE fl=T_XLD es le bie$OICUE fl=T_NLD pe=eh "{a} |ge -f"{U_I}vr_rfre" rf`co $vr" rp c $CRDR/aspeerd` f i #gttedt oto tevral e h aa u f h aibe dt=nrmgt$vr` aa`va e {a} #wietevrt tefl adue\frseilcas ($" rt h a o h ie n s o pca hr: \`) eh -n"va st$vr=" |te-a$T_L}> $bie co e nrm e {a}\" e i {OAL > {fl} eh - "{aa"| sd- '/$"]\&g |te-a $T_L}> $bie co n $dt} e e s[`\/\/' e i {OAL > {fl} eh - "" |te-a $T_L}> $bie co e \" e i {OAL > {fl} i [!$pe}= 0] te f {rf = ; hn eh -n"va st$vr=" > $T_RFRE} co e nrm e {a}\" > {OPEERD eh - "{aa"| sd- '/$"]\&g > $T_RFRE} co n $dt} e e s[`\/\/' > {OPEERD eh - "" > $T_RFRE} co e \" > {OPEERD f i dn oe ############################# ############################ #cenprmv /p/m/l_as lau eoe ottpalvr #ucmett rmv fl nomn o eoe ie ############################# ############################ #r $VRIE m {AFL} ############################# ############################ #Wiefoe t rsoesrp rt otr o etr cit ############################# ############################
eh - "n Cmi vralsnco\Sv vralst nrm"nva cmi" |te-a $T_L}|t co e \# omt aibe\eh "ae aibe o va\\nrm omt e i {OAL ############################# ############################ #Cag prisoso rsoesrpst mk te hne emsin n etr cit o ae hm #eeual xctbe ############################# ############################ cmd+ $T_NLD} ho x {OICUE cmd+ $T_RFRE} ho x {OPEERD cmd+ $T_XLD} ho x {OECUE cmd+ $T_L} ho x {OAL ############################# ############################ #Cmrs rsoesrpsadsn te t fpsre opes etr cit n ed hm o t evr ############################# ############################
i [$tase}-e0];te f {rnfr n hn trcf-- /"{OICUE"2/e/ul|gi - | /p/i/ul- - $UEPS}"{TS/{I a p C $T_NLD} >dvnl zp c otbncr s u {SRAS $FP}$FL trcf-- /"{OPEERD"2/e/ul|gi - | /p/i/ul- - $UEPS}"{TS/{ a p C $T_RFRE} >dvnl zp c otbncr s u {SRAS $FP}$F trcf-- /"{OECUE"2/e/ul|gi - | /p/i/ul- - $UEPS}"{TS/{I a p C $T_XLD} >dvnl zp c otbncr s u {SRAS $FP}$FL trcf-- /"{OAL"2/e/ul|gi - | /p/i/ul- - $UEPS}"{TS/{IE. a p C $T_L} >dvnl zp c otbncr s u {SRAS $FP}$FL}a f i
2/15/13
cso_htoncmad utmsudw_omn ^e_ df ^eal_ dfut ds_ye ittp d_a_dr lrmad erysatpcmad al_tru_omn ^t e0 ^t e1 ^z ec gnrt_e eeaeky gzl_cin oiaato gi po ^adae hrwr ^s i_ ^enl kre_ lndfut a_eal ^a_w lnh ^a_fae lninm lnes adv mna_otn aulbo_v ms_omd ici_oe ne_omt edcmi ^s o_ oecokn vrlcig p0apr amxw pydnm hi_u po_e mnvr pp_pinm pdppfae ppeinm po_fae ppewninm po_a_fae piayinm rmr_fae poebakit rb_lcls rglto_oan euaindmi rsu ece rst ee_ srth cac srm da ^h s_ ^kp si sh_s_otky sddshs_e sh_s_otky sdrahs_e satpcmad tru_omn ^a_eal wndfut ^a_w wnh ^a_f wni ^a_pr wnvot ^adv wnes wbho_irre e_oklbais ^ii wf_ w01had l._wdr w02had l._wdr w03had l._wdr w0had l_wdr w0inm l_fae w0rdod l_aiis ^l w_ ^ln wa_
The vars_preferred file. This is the file you add your vars to that you want to backup.
dyih_ie algttm tm_oe iezn
www.dd-wrt.com/wiki/index.php/Useful_Scripts 6/27
2/15/13
2/15/13
Thank you JLL and Glenfarclass and Cardhu for the help --Bib 02:13, 12 November 2012 (CET)
#Dcmrs Frwl eopes ieal nrmgtp_w|udcd - /m/Hf.z va e Hf ueoe o tpp_wg nrmustp_w va ne Hf gni /m/Hf.z uzp tpp_wg nrmstr_ieal"ct/m/Hf` va e cfrwl=`a tpp_w" nrmso >dvnl va hw /e/ul
#EiigteFrwl dtn h ieal v /m/Hf i tpp_w #fns eiigwt v bfr rnigters iih dtn ih i eoe unn h et nrmstr_ieal"ct/m/Hf` va e cfrwl=`a tpp_w" nrmso >dvnl va hw /e/ul
www.dd-wrt.com/wiki/index.php/Useful_Scripts
8/27
2/15/13
wiesep$NEVLd hl le ITRA;o NW`w 'ACP/& /S="TRE"/& /P=0 {rn } /a/o/esgs|ti -` E=ak /CET & DT'$AGT' & DT8/ pit ' vrlgmsae al 1 SC`w -'= ] 'ACP/& /S="TRE"/& /P=0 {rn } /a/o/esgs|ti -` R=ak F[| ' /CET & DT'$AGT' & DT8/ pit ' vrlgmsae al 1 LN=ak'ACP/& /S="TRE"/& /P=0'/a/o/esgs IE`w /CET & DT'$AGT' & DT8/ vrlgmsae` i ["NW ! " - "NW ! "OD ] te f $E" = " a $E" = $L" ; hn i pn -c$UP$AGT>dvnl;te f ig q NM TRE /e/ul hn eh "TRE wsacse b $R adi aiea"`ae co $AGT a cesd y SC n s lv t dt` > $OFL > LGIE es le eh "SCcue wk o lna"`ae co $R ass ae n a t dt` > $OFL > LGIE $O - 1218325- 7$A WL i 9.6..5 p MC > $OFL > LGIE sep5 le f i OD$E L=NW f i dn oe
Unfortunately that script wasn't working with V24-SP2's logging. I rewrote it to use dmesg and added some logging messages to help. Thanks go to rasos for the initial script!
#/i/h !bns #nbeJF2adpaesrp i /fs te rno satpi wbitrae Eal FS n lc cit n jf/ hn u n tru n e nefc. #o cncektelgfo ht:/9.6../srwlhm Yu a hc h o rm tp/121811ue/o.tl ITRA= NEVL5 NM= UP3 OD" L=" PR=0 OT8 WLOT9 OPR= TRE=9.6..0 AGT1218111 BODAT1218125 RACS=9.6..5 MC0:12:34:5 A=01:23:45 WL/s/bnwl O=ursi/o LGIE"tpwwwlhm" OFL=/m/w/o.tl eh "mt ht-qi="ers\ cnet\1\> >$OFL co <ea tpeuv\rfeh" otn="0"" LGIE eh "UOWLSrp satda"`ae "b> > $OFL co AT O cit tre t dt` <r" > LGIE wiesep$NEVLd hl le ITRA;o NW`ms |ak'ACP/& /S="TRE"/& /P="PR"/{rn } |ti -` E=deg w /CET & DT'$AGT' & DT'$OT' pit ' al 1 SC`ms |ak-'= ] 'ACP/& /S="TRE"/& /P="PR"/{rn $} |ti -` R=deg w F[| ' /CET & DT'$AGT' & DT'$OT' pit 7' al 1 LN=deg|ak'ACP/& /S="TRE"/& /P="PR"/` IE`ms w /CET & DT'$AGT' & DT'$OT'' i ["NW ! " - "NW ! "OD ] te f $E" = " a $E" = $L" ; hn i pn -c$UP$AGT>dvnl;te f ig q NM TRE /e/ul hn eh "OAE$AGTwsacse b $R adi arayaiea"`ae "b>> $OFL co NWK TRE a cesd y SC n s led lv t dt` <r"> LGIE es le eh "AE$R cue wk o lna"`ae "b>> $OFL co WK SC ass ae n a t dt` <r"> LGIE $O - $RACS - $OPR $A > $OFL WL i BODAT p WLOT MC > LGIE eh "b> > $OFL co <r" > LGIE sep5 le f i OD$E L=NW f i dn oe
2/15/13
This script will change your eth1 MAC address to a random address, then it will apply it to the system and restart the interfaces.
#/i/s !bnah MC`dt;ct/rcitrut)|m5u |sd- '/({0)*/1;s(09-]2)\:g s:/;` A=(ae a po/nerps dsm e r s^.1}.$\/ /[-af{}/1/; /$/' eh "0$MC" co 0:{A} icni eh h ehr0:{A} fofg t1 w te 0$MC nrmstdfhad=0:{A} va e e_wdr"0$MC" nrmstwnhad=0:{A} va e a_wdr"0$MC" sosriewn tpevc a satevc wn trsrie a
You may wish to also download curl (see ipkg), and use it to restart your modem, as some MAC changes may not reflect until your modem "sees" a new address, and they typically only do this when starting up. Note: curl is sometimes problematic to install. You should use ipkg -force-depends An example, to restart a Motorola Surfboard SB4100 cable model is:
cr - - "UTNIPTRsatCbeMdm ht:/9.6.0./ofgaahm ul s d BTO_NU=etr+al+oe" tp/1218101cnidt.tl
I added the following lines to the end of the above to restart a Motorola SB5120 (no curl required!!) and reboot. Running this script in cron, and my ISP won't automatically recover without the following:
nrmcmi &sep5& we ht:/9.6.0./ee.t?ee_oe=etr+al+oe va omt le & gt tp/1218101rsthmrstmdmRsatCbeMdm rbo eot
Don't know the reason but Motorola SB5101 only re-started with the two following lines:
cr - - "etrFcoyeal=&eeRq1 ht:/9.6.0./oomRCni ul v d RsoeatrDfut1Rste=" tp/1218101gfr/gofg cr - Rste= ht:/9.6.0./oomRCni ul d eeRq1 tp/1218101gfr/gofg
2/15/13
# w sa;w sarsls l cn l cneut #admk sr yucnrntoecmad.I ntti pormwl ntwr. n ae ue o a u hs omns f o hs rga il o ok #I yusceddwt tesarslste f o ucee ih h cneut hn #cp adpseti etr tx it tetria wno oy n at hs nie et no h emnl idw #(h ct->sanrln wl cp ters o tefl it afl nmd'cne' te a cne ie il oy h et f h ie no ie ae sanr) #adte htrtr adte cr- t coetefl. n hn i eun n hn tlc o ls h ie #te js rnsrp b tpn tefloigln: hn ut u cit y yig h olwn ie # ak- sanr w f cne # #Ihrb rlaeti it tepbi dmi.Jsi Jns 20 eey ees hs no h ulc oan utn oe, 05 # #Jn '7cretdbgfo '6ipoeet a. 0 orce u rm 0 mrvmn.
BGN EI{ INRCS =1 GOEAE ; cmad="lsa 2 /e/ul;w sarsls2 /e/ul; omn w cn > dvnl l cneut > dvnl" rd="xb3m; e \1[1" gen="xb3m; re \1[2" genak"xb4m; rebc=\1[2" ylo ="xb3m; elw \1[3" ca ="xb3m; yn \1[6" bu ="xb3m; le \1[4" bubc ="xb4m; leak \1[4" wie="xb3m; ht \1[7" wieak="xb4m; htbc \1[7" rst="xb0" ee \1[m; udrcr ="xb4" nesoe \1[m; cer="xb2" la \1[J; hm ="xb00" oe \1[;H; eaeed="xbK; rs2n \1[" cae=wie Nm ht; cinl=gen Sga re; cos =rd Nie e; cas=gen Cp re; ctegho =bu bubc; chne =gen SrntLw le leak Canl re; cteghe =wiewieak SrntMd ht htbc; cteghi=gengenak SrntH re rebc; cteghgd=rd SrntAe e; pitcer rn la; fr;) o(; { wie(omn|eln) hl cmadgtie { i(^SD){nm =; rs =;os=;rs=" nie";hne="bsd";as"} f/SI/ ae si nie si"; os="canl";si="cp=" i(^oe){si=;os=;canl= } f/Md/ rs nie hne i(^SI/ {si =;cp ="" " " " " "} f/BSD) bsd as " " " " " i(^upre/ f/Spotd) { nm[si]=nm aebsd ae rs[si]=rs sibsd si niebsd=nie os[si] os canlbsd =canl hne[si] hne cp[si]=cp asbsd as } } coecmad ls(omn) pit hm; rnf oe l =0 n ; pitwie"Nm rn ht ae BSD Sga NieCanlTp" SI inl os hne ye; fr( i nm) o x n ae { { #rirr srnt cl truhtiladerr. mdf a yuws: abtay tegh ac hog ra n ro.. oiy s o ih sgtegh=(rs[]-niex)15 +(rs[]+0*.) isrnt (six os[]*.) (six 9)15; i (isrnt <)sgtegh0 f sgtegh 1 isrnt=; ctegh=ctegho; Srnt SrntLw i(isrnt>)ctegh=cteghe; fsgtegh4 Srnt SrntMd i(isrnt>)ctegh=cteghi fsgtegh7 Srnt SrntH; i(g[]0 ctegh=cteghgd faex=) Srnt SrntAe; ft="s-5 %%"isrnt" "ee eaeed"n m %%1s s0sgteghd rst rs2n \
www.dd-wrt.com/wiki/index.php/Useful_Scripts
2/15/13
pit ft caenm[]ctegh0xcinlrs[]cos,os[]chne,canlx,C rnf m, Nm,aex,Srnt,,,Sga,six,Nieniex,Canl hne[]ca rs[]="10 xx" six -00 xx; l+; n+ }
} i (n=0 pitrd"oRsls-D yuhv w sa cpblt?\Ti pormdpnso 'lsa f l =) rn e N eut o o ae l cn aaiiy nhs rga eed n w cn piteaeed rn rs2n; } }
2/15/13
sgtegh=(rs[]-niex)15 +(rs[]+0*.) isrnt (six os[]*.) (six 9)15; i (isrnt <)sgtegh0 f sgtegh 1 isrnt=; ctegh=ctegho; Srnt SrntLw i(isrnt>)ctegh=cteghe; fsgtegh4 Srnt SrntMd i(isrnt>)ctegh=cteghi fsgtegh7 Srnt SrntH; i(g[]0 ctegh=cteghgd faex=) Srnt SrntAe; ft="s-5 %%"isrnt" "ee eaeed"n m %%1s s0sgteghd rst rs2n \ % s %%4 %%4 %%4 %%s" rs s-d s-d s-d s2 ee pit ft caenm[]ctegh0xcinlrs[]cos,os[]chne,canlx,C rnf m, Nm,aex,Srnt,,,Sga,six,Nieniex,Canl hne[]ca rs[]="10xx" six -0 xx; l+; n+
} i (n=0 f l =) pitrd"orsls-D yuhv sre cpblt?\Ti pormdpnso st_uvyt rn rn e N eut o o ae uvy aaiiy nhs rga eed n iesre o u. piteaeed rn rs2n; } } '
LAE`rp"bSAINb"$TTC` ES=ge \$TTO\$ SAIS i [- "LAE ] te f n $ES" ; hn I=eh $ES |ak'pit}` P`co LAE w {rn ' MC`co$ES |ak'pit}` A=eh LAE w {rn ' $O - $P$A WL i I MC es le eh Ual t fn \$TTO\ i DC sai fl $TTC,pes ue\ \hsnm\\ co nbe o id "SAIN" n HP ttc ie SAIS lae s " <otae>" f i
www.dd-wrt.com/wiki/index.php/Useful_Scripts
13/27
2/15/13
LAE`rp"$TTO, $TTC` ES=ge ,SAIN" SAIS i [- "LAE ] te f n $ES" ; hn NT`co$ES |ak-,'slt$,p"";rnf"s%.s25,p1,p2,p3)' E=eh LAE w F {pi(3i,.)pit(%.s%.5"i[]i[]i[]}` I=eh $ES |ak-,'pit$}` P`co LAE w F {rn 3' MC`co$ES |ak-[= 'pit$}` A=eh LAE w F,] {rn 2' eh Wkn u $TTO o bodat$E a i $PadMC$A co aig p SAIN n racs NT t p I n A MC $O - $E $A WL i NT MC es le eh "nbet fn \$TTO\ i DC sai fl $TTC. co Ual o id "SAIN" n HP ttc ie SAIS" ei 1 xt f i
M=bsnm $` E`aeae 0 RNIG`s|ak''$E' {+} ED{rn x0' UNN=p w /"M"/ +x; N pit +}` i ["RNIG -t3] te f $UNN" g ; hn
www.dd-wrt.com/wiki/index.php/Useful_Scripts 14/27
2/15/13
eh "nte isac o \$E"i rnig co Aohr ntne f "M\ s unn" ei 1 xt f i wiesep$NEVL hl le ITRA d o TRE=i rue|ak'dfutva {rn $}` AGT`p ot w /eal i/ pit 3' RT`ig- $AKT $AGT2 /e/ul|ak'pcesrcie/{rn $}` E=pn c PCES TRE > dvnl w /akt eevd pit 4' i ["RT -e"PCES ] te f $E" n $AKT" ; hn eh "igfie,rlaigI adeso $FC" co Pn ald eesn P drs n IAE #edaRLAEsga sn EES inl kl -S2`a /a/u/dccpd 2 /e/ul il UR ct vrrnuhp.i` > dvnl #nueuhp i ntrnig esr dcc s o unn klaluhp 2 /e/ul ill dcc > dvnl eh "eeigI ades $FC" co Rnwn P drs: IAE $DCC UHP eh "atn 1 s." co Wiig 0 .. sep1 le 0 es le eh "ewr i u va$AGT co Ntok s p i TRE" f i dn oe
The following version will work even on resource-starved Linksys WRT54G v8, which lacks most programs needed by the script above. To use it, just add this code to DD-WRT's startup script using the web interface.
ITRA=0 NEVL1 wietu;d hl re o wie[\ $w] d hl ! g ; o sep3 le 0 rue- >tprue ot n /m/ots wiera ds g fo d hl ed et w o; o i [$et="..."] te f ds 0000 ; hn bek ra f i dn <tprue oe /m/ots dn oe lge "uorpi:dfutgtwyi $w ogr at-ear eal aea s g" wiepn -c2$w>dvnl ;d hl ig q g /e/ul o sep$NEVL le ITRA dn oe lge "uorpi:gtwydw,rsatn WN ogr at-ear aea on etrig A" kl -S1`a /a/u/dccpd il UR ct vrrnuhp.i` ustg ne w dn & oe
www.dd-wrt.com/wiki/index.php/Useful_Scripts
15/27
2/15/13
Alternatively, if you want to give priority to you're personally installed applications (i.e. you've installed a more robust version of grep, and want to use it by default), add the new paths before $PATH and $LD_LIBRARY_PATH, as shown below.
#/i/h !bns epr PT=mcbn/htvrbn$AH xot AH/m/i:waee/i:PT epr L_IRR_AH/m/i:waee/i:L_IRR_AH xot DLBAYPT=mclb/htvrlb$DLBAYPT
To use this script you first need to enable syslog on your router without stating an IP. Then the log will be saved in /var/log/messages. You can do this under Administration->Services and then scroll down to the "System Log" section. Click "Enable" and leave "Remote Server" empty. After you saved the script under /tmp/www/ as "log.sh" you must mark it as executable with "chmod +x /tmp/www/log.sh". You can do that by saving the following in your startup script:
To view the log in your browser point it to "http://<routerip>/user/log.sh" It appears that the above method doesn't work under some versions of v24 as shell scripts need to be created in the cgi-bin folder in order for the webserver to execute them. If you find the previous startup script doesn't work, try the following:
mdr/m/w/g-i ki tpwwcibn eh -n"!bns\eh 'HM>HA>TTELgie/IL>/ED'nco'BD>\nrmgtrue_ co e #/i/hnco <TL<ED<IL>ofl<TTE<HA>\eh <OY'nva e otrn cmd+ /m/w/g-i/o.h ho x tpwwcibnlgs
www.dd-wrt.com/wiki/index.php/Useful_Scripts 16/27
2/15/13
eh -n"!bns\r /m/w/ylghm\eh 'HM>HA>TTELgie(eeae:'> /m/w co e #/i/hnm tpwwsso.tlnco <TL<ED<IL>ofl Gnrtd > tpww cmd+ /m/w/o_e.h ho x tpwwlggns
Save the above code to your startup script and create a cron job for it. To generate a HTML log every 15 minutes you could use this job:
*1 ****ro /m/w/o_e.h /5 ot tpwwlggns
Your router's syslog is now available on http://<routerip>/user/syslog.html and will be updated every 15 minutes (or whatever you've set in the cron job).
2/15/13
sga=ak - ""'atv_iees {pit inl`w F ' /ciewrls/ rn } $m_ie ' tpfl` eh $inl|ak'pit"inl : "\"fr;<j+pit""pit"n} co sga w {rnfSga "t;o(j;+)rnf=;rnf\"' i [ - $inl] ;te f [ n sga ] hn eh $inl|fsia -ts co sga etvl -t es le eh "o ascae"|fsia -ts co Nt soitd etvl -t f i dn oe
This works by using the same process as the 'Status-->Wireless' page i.e. it gets a chunk of data by wget'ing the Status_Wireless.live.asp page from the WRT then running awk to get the relevant chunk of data (the signal strength) and then piping that into the festival speech engine. Now I just run this script and turn up the volume on my computer when I need to move the antenna.
2/15/13
eh 0>/rcssntiv/ofeh/euerdrcs co po/y/e/p4cn/t1scr_eiet eh 1>/rcssntiv/cpinr_ou_ro_epne co po/y/e/p4im_goebgserrrsoss eh 5>/rcssntiv/gpmxmmesis co po/y/e/p4im_a_ebrhp eh 2>/rcssntiv/gpmxmf co po/y/e/p4im_a_s eh 12 >/rcssntiv/c_a_rhn co 04 po/y/e/p4tpmxopas eh 2>/rcssntiv/c_y_ere co po/y/e/p4tpsnrtis eh 2>/rcssntiv/c_yakrtis co po/y/e/p4tpsnc_ere eh 1>/rcssntiv/c_br_noefo co po/y/e/p4tpaoto_vrlw eh 1 >/rcssntiv/c_i_ieu co 0 po/y/e/p4tpfntmot eh 0>/rcssntiv/ot/eietnme co po/y/e/p4ruerdrc_ubr eh 1>/rcssntiv/ofalr_itr co po/y/e/p4cn/l/pfle eh 1>/rcssntiv/ofeh/pfle co po/y/e/p4cn/t1r_itr eh 1>/rcssntiv/c_ycois co po/y/e/p4tpsnoke eh 0>/rcssntiv/ofalacp_orerue co po/y/e/p4cn/l/cetsuc_ot eh 6 >/rcssntiv/pdfuttl co 1 po/y/e/p4i_eal_t #DSpoeto b tekn tetmot o rtcin y waig h ieus eh "80 >/rcssntiv/c_eplv_ie co 10" po/y/e/p4tpkeaietm eh "">/rcssntiv/c_idwsaig co 0 po/y/e/p4tpwno_cln eh "">/rcssntiv/c_ak co 0 po/y/e/p4tpsc #W peedt b aCekon frwl o WnosX e rtn o e hcpit ieal n idw P eh 49 8304934>po/y/e/p4tpre co 06 78 140 /rcssntiv/c_mm eh 49 8304934>po/y/e/p4tpwe co 06 78 140 /rcssntiv/c_mm #Cekntokoela (xlctcneto ntfcto) hc ewr vrod epii ogsin oiiain eh 1>/rcssntiv/c_c co po/y/e/p4tpen #Cag pr rnefroton tafc hne ot ag o ugig rfi eh "00 600 >/rcssntiv/plclpr_ag co 300 00" po/y/e/p4i_oa_otrne #Cag dfutqeesz hne eal uu ie #Mdfe frD-R bcueo msigpo etis oiid o DWT eas f isn rc nre eh 49 >/rcssntiv/pcntakmx co 06 po/y/e/p4i_onrc_a #LDsga febc we srp ed E inl edak hn cit ns sep1 le gi eal 3 po nbe sep1 le gi dsbe3 po ial sep1 le gi eal 3 po nbe sep1 le gi dsbe2 po ial sep1 le gi eal 2 po nbe sep1 le gi dsbe2 po ial #I yudlk t dsbetewbitraeucmet f o' ie o ial h e nefc nomn #tefloigln h olwn ie #ill htd klal tp
Attention, you might have to change eth1 to the actual WAN (external) interface. Installation is pretty simple: 1. Log on to your WRT 2. type c / f s d jf 3. type v s c s (or any other name) and enter the script i e.h
www.dd-wrt.com/wiki/index.php/Useful_Scripts 19/27
2/15/13
4. 5. 6. 7.
Connect to your WRT via web browser, page Administration:Commands Enter the script name (sec.sh) into the command field Click on "Save Startup" Reboot router
As a simple test try to ping your router. You should get no response otherwise you have to find the error.
itbe - IPT- tp- DO pals I NU p c j RP itbe - IPT- `va gtlniad``va gtlnntak - tp- mliot-dot `va pals I NU s nrm e a_pdr/nrm e a_ems` p c m utpr -prs nrm itbe - IPT- `va gtrmt_p|ak'pit}`- tp- mliot-dot `va gtsh pals I NU s nrm e eoei w {rn ' p c m utpr -prs nrm e sd
This allows the lowest (first) IP address set in the "Allow any remote IP" feature to connect to the https and ssh servers in the WAP (you just need the password and/or the private key) ;) . In addition, all LAN ip are allowed to do the same. Althought the "Allow any remote IP" feature doesn't work at this time when the router is set as a WAP (LAN-LAN link to the gateway, so no routing and WAN disabled, dhcp off and other stuff), this convenient script will use the first "remote_ip" you set in the GUI (wether the feature is enabled or not, as long as you stored at least one IP) and will follow the changes you could do to its static lan ip/netmask and ssh server port. Now you have full benefit of the GUI from a remote static IP and can leave the forwards enabled on the path. EDIT 2011/06/25: even with elder releases, the remote IP can be hardcoded in the script, replacing `nvram get remote_ip | awk '{print }'` by the actual IP. --Bib 14:03, 17 May 2010 (CEST) EDIT 2011/08/16: I slightly change this script to make it work when the WAP's LAN IP is set through dhcp instead of static:
itbe - IPT- tp- DO pals I NU p c j RP I_A=icni b0|ge ie |ct-:-2|ct-''-1 PLN`fofg r rp nt u d f u d f` MK`fofgb0|ge ie |ct-:-4 S=icni r rp nt u d f` itbe - IPT- $I_A}$S - tp- mliot-dot `va gtsh_ot,4,0- ACP pals I NU s {PLN/MK p c m utpr -prs nrm e sdpr`438 j CET itbe - IPT- `va gtlniad``va gtlnntak - tp- mliot-dot `va pals I NU s nrm e a_pdr/nrm e a_ems` p c m utpr -prs nrm itbe - IPT- `va gtrmt_p|ak'pit$}`- tp- mliot-dot `va gts pals I NU s nrm e eoei w {rn 1' p c m utpr -prs nrm e s
Remove the port 80 after you have backed up your conf. --Bib
www.dd-wrt.com/wiki/index.php/Useful_Scripts 20/27
2/15/13
2/15/13
#scnsbtencek eod ewe hcs CEKEEY6 HC_VR=0 #atrccig wi ti mn scns fe yln, at hs ay eod ATRCCE30 FE_YL=6 #Cin ms b u bfr satn mi lo let ut e p eoe trig an op wietu hl re d o i pn - 1$CIN_P >dvnl f ig c {LETI} /e/ul te hn eh "{LETU}o -bgnn mi lo" co $CIN_P k eiig an op bek ra f i dn oe #mi srp an cit wiesep$CEKEEY hl le {HC_VR} d o i pn - 1$CIN_P >dvnl f ig c {LETI} /e/ul te hn eh "{LETI}o" co $CIN_P k es le eh "{LETI}dopdoe co $CIN_P rpe n" sep$FI_GI} le {ALAAN i !pn - 1$CIN_P >dvnl f ig c {LETI} /e/ul te hn eh "{LETI}dopdto snigrsatn $ITRAE" co $CIN_P rpe w, edn etrig {NEFC} #o Ahrshrwr isedue icni $ITRAE dw n teo adae nta s: fofg {NEFC} on w - $ITRAE dw l i {NEFC} on sep3 le #o Ahrshrwr isedue icni $ITRAE u n teo adae nta s: fofg {NEFC} p w - $ITRAE u l i {NEFC} p sep$ATRCCE le {FE_YL} f i f i dn 2& oe >1
frii `rp0 /rcntap|ct- ''-1;d eh "icneto cut $ge - $ /rcnt o n ge x po/e/r u d f` o co $ oncin on: (rp c i po/e/
frii `rp0 /rcntap|ct- ''-1;d eh "icneto cut $ge - $ /rcnt o n ge x po/e/r u d f` o co $ oncin on: (rp c i po/e/
2/15/13
pap=yes" while HOT setting is the opposite. Fix was risen by aviad_ra @ http://www.ddwrt.com/phpBB2/viewtopic.php?t=17002&postdays=0&postorder=asc&highlight=l2tp&start=15 This is a cleaned up version of the same script. Add the script as a startup script.
#/i/h !bns wie:;d hl o lge - - lcl.oie- LT "aiaig\rfs pp=n\" ogr s p oa0ntc t 2P Vldtn "eue a o" wie[ - /m/ltdx2p.of& - "ct/m/ltdx2p.of|ge "euepp=ys hl [ e tpx2p/ltdcn & n `a tpx2p/ltdcn rp rfs a e d o lge - - lcl.oie- LT "i i nee a \rfs pp=ys" ogr s p oa0ntc t 2P Fx s edd s "eue a e\" ct/m/ltdx2p.of|sds"euepp=ys/rfs pp=n"g>/m/ltd a tpx2p/ltdcn e /rfs a e""eue a o/ tpx2p m /m/ltdx2p.oftp/m/ltdx2p.of v tpx2p/ltdcn.m tpx2p/ltdcn lge - - lcl.oie- LT "ltdcn hsbe fxd ogr s p oa0ntc t 2P x2p.of a en ie" sep5 le dn oe sep3 le 0 dn& oe
snmi -"mpcmatnt -"edrcmatnt -"DWT -"ocs.e"-"sb"-"mg m edal Sst.ocs.e" fsne@ocs.e" FD-R" dcmatnt s$uj m$s" e }
#as tepeiu dyadmnhyttl adsn a eal Pre h rvos a n otl oas n ed n mi af"f"#ewr wraon f=af kyod okrud ya=(ae- % - $($dt +s -840)+d dy$dt D s d ( (ae %) 60) %) yo=(ae- % - $($dt +s -840)+raf%-Y mn$dt D s d ( (ae %) 60) t$f-m%) i [$dt +d -q1] te mns=Ls Mnh;es mns=Mnht Dt" f f (ae %) e ; hn omg"at ot" le omg"ot o ae; i mg$nrmgt$mn|ak'pit$$dy,$F'|sd'/(^]\:(^]\ \\[:*)\[]*)/ s=(va e yo w {rn 'ya' N} e s\[:*)\[ *) [(^]\:(^]\] fcmi "adit Rpr""mg "tpbmi.o" n_al Bnwdh eot $s" /m/wallg
www.dd-wrt.com/wiki/index.php/Useful_Scripts
23/27
2/15/13
#aibe Vrals # #uea1 mnt itra s 0 iue nevl ITRA=0 NEVL60 #e DSetyt cek st N nr o hc RMT_N=CAG T YU DS EOEDS*HNE O OR N*
#### #### Bd o Srp ######## oy f cit ####### wiesep$NEVL hl le ITRA d o #Strmt I vral e eoe P aibe RMT_P`ig- 1$EOEDS|ge "PN"|ct-3-""|ct-2-""|ct-1-"" EOEI=pn c RMT_N rp ^IG u f d u f d( u f d)` #e edn ottvral t b oemr ta tels otto termt ades St nig ce aibe o e n oe hn h at ce f h eoe drs ltEDN_CE=eh $EOEI |ct-4-""+ e NIGOTT`co RMT_P u f d.`1 #eemn tecretI adesta' ue frrmt mngmn dtrie h urn P drs hts sd o eoe aaeet CRETAMNI=nrmgtrmt_p|ak'pit$}` URN_DI_P`va e eoei w {rn 1' ##I termt I hscagd te cag teammI stig # f h eoe P a hne, hn hne h di P etn i ["CRETAMNI"! "RMT_P ] te f $URN_DI_P = $EOEI" ; hn #ofgr WPt alwti I adest cnetrmtl cniue A o lo hs P drs o onc eoey nrmstrmt_p"RMT_P$NIGOTT va e eoei=$EOEI EDN_CE" #aenrmstig sv va etns nrmcmi >/e/ul2& va omt dvnl >1 f i dn oe ##Edo srp # n f cit
d -Dsly mutdetra dvcs sc a UBsoae f ipas one xenl eie, uh s S trg. Ued - t seteata sz vle i s f h o e h cul ie aus n
mut-Mut a etra dvc sc a aUBHD(xml: mut/e/cihs0bs/agt/u0p on ons n xenl eie uh s S D Eape on dvss/ot/u0tre0ln/
mut-bn -Bnsa oddrcoyt anwdrcoy(xml:mut-bn /m/n/m)-Tp on -id id n l ietr o e ietr Eape on -id tpmttp ye
www.dd-wrt.com/wiki/index.php/Useful_Scripts
24/27
2/15/13
tp-Dsly alrnigpoessicuigteCUuae Mmr Uaeads o o ipas l unn rcse nldn h P sg, eoy sg n o n
deg|mr -Wl dslyRue ifrainoesgeta atm (emnlwno sz)adb hti ms oe il ipa otr nomto n emn t ie tria idw ie n y it
p -Wl dslyalrnigpoess-Uep -hl t dslymr otos s il ipa l unn rcse s s -ep o ipa oe pin.
fe -Dsly cretmmr saitc,adb ue wt etnin (xml:fe -)-Uefe re ipas urn eoy ttsis n e sd ih xesos Eape re l s re ?
ct-Vr,vr ueu adcndslyaliptotu msae fo terue" (xml:ct/m/ a ey ey sfl n a ipa l nu/upt esgs rm h otr Eape a tpv
www.dd-wrt.com/wiki/index.php/Useful_Scripts
25/27
2/15/13
mdr-Mksadrcoy i wiho cus yune t seiy(xml:mdr/n/fs T mutt ki ae ietr, n hc f ore o ed o pcf Eape ki mtjf) o on h
r -Rmvsadrcoy(xml:c /p te r -f* - Rmvsteotdrcoy m eoe ietr Eape d ot hn m r ) > eoe h/p ietr
sep-Cue tepoest dlysatpfrseiidtm (xml:sep2 & /p/i/uyo s le ass h rcs o ea tru o pcfe ie Eape le 0 & otbnbsbx w
con-Cag teonrado gopo ec FL t ONRado GOP-Tp con-hl frsrn hw hne h we n/r ru f ah IE o WE n/r RU ye hw -ep o tig
cmd-Alw priin cagn o drcois(xml:cmd+ /fseccni/ -Te+ srn ho los emsos hnig n ietre Eape ho x jf/t/ofg) h x tig
See Also
LED Scripts Startup Scripts Script Examples Retrieved from "http://www.dd-wrt.com/wiki/index.php/Useful_Scripts" Categories: Scripts | Tutorials
Article | Discussion | Edit | History What links here | Related changes | Upload file | Special pages
www.dd-wrt.com/wiki/index.php/Useful_Scripts 26/27
2/15/13
| Permanent link Print as PDF This page was last modified 07:36, 12 November 2012. This page has been accessed 628,696 times. About DD-WRT Wiki | Disclaimers | Powered by MediaWiki | Design by Paul Gu
www.dd-wrt.com/wiki/index.php/Useful_Scripts
27/27