Batch file to read information from a router's config file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • justintaitt
    New Member
    • Jun 2007
    • 11

    Batch file to read information from a router's config file

    Hi,
    I am an intern and I am tasked with writing a batch file to get information from a router's config file then store it in a database on a server. I do not have any idea of how to do this and so far have found nothing which sheds any light.

    Can someone please tell me if this is possible and point me in the right direction.

    Thanks in advance
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, justintaitt. Welcome to TSDN!

    I'm going to go ahead and move this to the Windows forum, where you'll receive more relevant exposure.

    Comment

    • epots9
      Recognized Expert Top Contributor
      • May 2007
      • 1352

      #3
      it might have to done manually cuz when i tried backuping up my router's (linksys) config, its stores it in a CFG format which is no problem....but it encrypts so when u open it its all garbage.

      but every router could be different, so see what happens when u backup.
      i'm thinking the only way is to change the firmware but i doubt the company who made your router would give u the source to modify.

      good luck

      Comment

      • justintaitt
        New Member
        • Jun 2007
        • 11

        #4
        Hi
        Doing it manually is not an option since that was what sparked the problem in the beginning. However now I am looking at some other alternatives.

        Thanks

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Heya, justintaitt.

          What is the router's brand/model?

          Comment

          • justintaitt
            New Member
            • Jun 2007
            • 11

            #6
            I am not sure. I was just given an overview and told to check it out. I'll find out and get to you all though.

            So far I was thinking about using winscp to copy the config file to the local pc then work from there.

            Comment

            • justintaitt
              New Member
              • Jun 2007
              • 11

              #7
              Hi everyone,
              It is a Cisco router.

              Comment

              • epots9
                Recognized Expert Top Contributor
                • May 2007
                • 1352

                #8
                Originally posted by justintaitt
                Hi everyone,
                It is a Cisco router.
                if u save a backup of the config on to your, can u view it or is it encrypted?

                Comment

                • justintaitt
                  New Member
                  • Jun 2007
                  • 11

                  #9
                  Hi,
                  I am not sure if it is encrypted or not. As I said before I have not yet been given the project officially so I do not have much info.
                  Could you still give me your suggestion anyway?

                  Thanks

                  Comment

                  • pbmods
                    Recognized Expert Expert
                    • Apr 2007
                    • 5821

                    #10
                    Heya, justintaitt.

                    Where is the file located?

                    Can you FTP into that computer/server? Can you SSH?

                    Comment

                    • epots9
                      Recognized Expert Top Contributor
                      • May 2007
                      • 1352

                      #11
                      well if it isn't encrypted then u just create a program that will read the file line by line and send the data to the database.

                      Comment

                      • justintaitt
                        New Member
                        • Jun 2007
                        • 11

                        #12
                        I can SSH to the router using PuTTY

                        Comment

                        • pbmods
                          Recognized Expert Expert
                          • Apr 2007
                          • 5821

                          #13
                          Heya, justintaitt.

                          Originally posted by justintaitt
                          I can SSH to the router using PuTTY
                          Excellent. Check out PHP's SSH Functions.

                          Comment

                          • justintaitt
                            New Member
                            • Jun 2007
                            • 11

                            #14
                            Ok
                            I will check out that site and pass it on to the other intern.

                            Thanks alot

                            Comment

                            • ghostdog74
                              Recognized Expert Contributor
                              • Apr 2006
                              • 511

                              #15
                              what other tools can you use to parse the file, assuming its readable, besides DOS batch ? Parsing files in DOS is tedious and error prone IMO. you might as well go with other tools good for parsing files, like Python/Perl/Vbscript/awk/sed...etc... they make your job easier.

                              Comment

                              Working...