Skip to content

dobizz/PyLDT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyLDT

Python Automation for PLDT Fibr ONU Router

Usage

Run script

python3 PyLDT.py

Current script contains a PyLDT Python class for configuring your PLDT Fibr ONU Router and does the following things:

  1. Check if https://192.168.1.1/fh is available and accepting requests.
  2. Logon using fibersuperadmin credentials and enable telnet, webadmin switch, and omci debug.
  3. Connect to the modem via telnet on port 22 and disable AP isolation so that you can use all of the LAN ports of your router.
Best used as a crontab task in Linux or scheduled task in Windows.

Assumptions

  1. The ipv4 address of your router is 192.168.1.1 and is reachable from the device running this software
  2. You are the owner or have authority over the router
  3. There are no firewalls or restrictions that prevent or block you from reaching port 22 of the router

Dependencies

ChromeBrowser

Download Google Chrome Browser https://www.google.com/intl/en/chrome/

ChromeDriver

Download your version of ChromeDriver https://chromedriver.chromium.org/

Make sure that the path to the chromedriver executable is included in the system path.

Python Pakages

Install all the required Python packages

pip install -r requirements.txt

Available Telnet Commands

User Exec Mode

Login: gepon
Password: gepon

User>
Command List
  1. clear
  2. enable
  3. exit
  4. help
  5. list
  6. ping {[-t]}*1 {[-count] <1-65535>}*1 {[-size] <1-6400>}*1 {[-waittime] <1-255>}*1 {[-ttl] <1-255>}*1 {[-pattern] <user_pattern>}*1 {[-i] <A.B.C.C>}*1 <A.B.C.D>
  7. quit
  8. show history
  9. show idle-timeout
  10. show ip
  11. show services
  12. show syscontact
  13. show syslocation
  14. terminal length <0-512>
  15. who
  16. who am i

Global Config Mode

From User Exec Mode key in enable and type the correct password to enter Global Config Mode

User>
User> enable
Password: *****

Config# _
Command List
  1. cd [..|device|service|switch|codec|dsp|protocol|pon|gpon|omci|wlan|tr069|wan|igmp|gponl3|oam|ntp|mld|web]
  2. clear
  3. download ftp [system|config] <A.B.C.D>
  4. erase {startup-config}*1
  5. exit
  6. help
  7. list
  8. quit
  9. reboot
  10. resettings
  11. save {configuration}*1
  12. show cpu use
  13. show flash use
  14. show history
  15. show memory use
  16. show running-config
  17. show startup-config
  18. show time
  19. show version
  20. upload ftp config <A.B.C.D>
  21. upload ftp syslog <A.B.C.D>

Debug Mode

From User Exec Mode or Global Config Mode key in ddd to enter Debug Mode

User>
User> ddd
WRI(DEBUG_H)> _
Config#
Config# ddd
WRI(DEBUG_H)> _
Command List
  1. active section [0|1]
  2. bobtest read_regs slave_addr <0-255> begin_addr <0-255> count <1-32>
  3. bobtest write_regs slave_addr <0-255> begin_addr <0-255> count <1-32> value1 <0-255> {value2 <0-255>}*1 {value3 <0-255>}*1 {value4 <0-255>}*1 {value5 <0-255>}*1 {value6 <0-255>}*1 {value7 <0-255>}*1 {value8 <0-255>}*1 {value9 <0-255>}*1 {value10 <0-255>}*1 {value11 <0-255>}*1 {value12 <0-255>}*1 {value13 <0-255>}*1 {value14 <0-255>}*1 {value15 <0-255>}*1 {value16 <0-255>}*1 {value17 <0-255>}*1 {value18 <0-255>}*1 {value19 <0-255>}*1 {value20 <0-255>}*1 {value21 <0-255>}*1 {value22 <0-255>}*1 {value23 <0-255>}*1 {value24 <0-255>}*1 {value25 <0-255>}*1 {value26 <0-255>}*1 {value27 <0-255>}*1 {value28 <0-255>}*1 {value29 <0-255>}*1 {value30 <0-255>}*1 {value31 <0-255>}*1 {value32 <0-255>}*1
  4. clear
  5. commit section [0|1]
  6. config ploam_log [enable| disable]
  7. config test clear_all_gemport_cnt
  8. config test mib_del_hi_tcont_alloc [0|1]
  9. config test web_acl_mode port <0-3> mode <0-2> type <0-2>
  10. config test web_acl_rule port <0-3> is_ipv6 <0-1> vid <0-4095>
  11. config upgrade_window_size <3characters>
  12. control opticalgenerator [enable|disable|off] {mode [hf0101 |lf0101 |mix |user |prbs7|prbs15|prbs23|prbs31]}*1
  13. control test up_optical_tx [auto| always_on | off] {tx_level [high |low]}*1
  14. debug cli_msg id
  15. debug cli_msg send_buf
  16. delete onuhw version
  17. dumpenv
  18. exit
  19. fandebug [enable|disable]
  20. fhdrv_kdrv_i2c read <0-10> <0-255> <0-255> <0-255>
  21. fhdrv_kdrv_i2c write <0-10> <0-255> <0-255> <0-255>
  22. get image status
  23. get nvram
  24. get saveflags status
  25. get system status
  26. get upgrade mem mode
  27. get version info
  28. get web [user|admin] username
  29. help
  30. i2c read
  31. i2c write
  32. list
  33. mibreset
  34. optdebug [enable|disable]
  35. output redirect
  36. printenv env_key [fhsnoui|FHSNOUI|ethaddr]
  37. quit
  38. read gpio <0-256>
  39. read i2c device page <0-255> addr <0-255>
  40. run [local_config]
  41. run [omci_tl]
  42. set bar code [pcb|bosa]
  43. set catv rf offset
  44. set console [on|off|reboot_on|reboot_off]
  45. set default-printf-to [disable|console|telnet|all]
  46. set electricfan run temperature <0-100> stop temperature <0-100>
  47. set nvram
  48. set onuhw version
  49. set opt rxpoweradjust1 min max offset
  50. set opt rxpoweradjust2 min max offset
  51. set optoutpower level <0-2>
  52. set optoutpower offset
  53. set optpoll [enable|disable]
  54. set ponrate_config_switch <0-1>
  55. set upgrade mem mode <0-255>
  56. set web [user|admin] username password
  57. set web default [user|admin] username password
  58. setbuttondebug [disable|enable|ver|start]
  59. setleddebug [disable|enable|on|off]
  60. setlog [omci|none] [old|pkt|timer|conf|temp|info|none|warning]
  61. setpmlog <0-1>
  62. setusbdebug
  63. shell
  64. show [ponrate_config_switch]
  65. show bar code [pcb|bosa]
  66. show debugversion
  67. show electricfan work temperature
  68. show flash use
  69. show history
  70. show optoutpower level
  71. show optoutpower offset
  72. show optrxpower adjust
  73. show power supply
  74. show prbs_bist_error_state
  75. show rf power
  76. show test web_acl_mode port <0-3>
  77. show test web_acl_rule port <0-3>
  78. show upgrade_window_size
  79. test led
  80. tshell
  81. updateenv [fhsnoui|FHSNOUI|ethaddr]
  82. upload ftp any <A.B.C.D>
  83. write gpio <0-256> <0-1>
  84. write i2c device page <0-255> addr <0-255> value <0-255>

Disclaimer

Use at your own risk. In no event shall we be liable to you or any third parties for any special, punitive, incidental, indirect or consequential damages of any kind, or any damages whatsoever, including, without limitation, those resulting from loss of use, data or profits, and on any theory of liability, arising out of or in connection with the use of this software.