Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. detect a connection string

detect a connection string

Scheduled Pinned Locked Moved Visual Basic
databasequestionhelp
11 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mehrnoosh
    wrote on last edited by
    #1

    hi how can i detect a connection string in a program? i want to detect a connection string in a program and find the database that the program connect to it. i am writing a program that when it add to other program with sql database it must detect the connection string and the database that the program connects to it... please help me...

    C 1 Reply Last reply
    0
    • M mehrnoosh

      hi how can i detect a connection string in a program? i want to detect a connection string in a program and find the database that the program connect to it. i am writing a program that when it add to other program with sql database it must detect the connection string and the database that the program connects to it... please help me...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      well, this sounds nasty, but, really what you want to do is load the whole program and it's config files as binary data, then go through it looking for something that matches a regex designed to find connection strings.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      M 1 Reply Last reply
      0
      • C Christian Graus

        well, this sounds nasty, but, really what you want to do is load the whole program and it's config files as binary data, then go through it looking for something that matches a regex designed to find connection strings.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        M Offline
        M Offline
        mehrnoosh
        wrote on last edited by
        #3

        i thik that your way is difficult... isnt there any way to answer this question? all the databases are sqlserver

        C 1 Reply Last reply
        0
        • M mehrnoosh

          i thik that your way is difficult... isnt there any way to answer this question? all the databases are sqlserver

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Well, you could use black magic I suppose. You have a binary file and you want to find connection strings in it. How do YOU propose to do that ? You MAY be able to write code that detects attempts to connect to a SQL Server, and find them that way. A more obvious approach is to look for SQL Servers that can be seen and then look to see what DBs they have, that would be a ton easier. It won't tell you which DB belongs to which program, obviously.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          M 1 Reply Last reply
          0
          • C Christian Graus

            Well, you could use black magic I suppose. You have a binary file and you want to find connection strings in it. How do YOU propose to do that ? You MAY be able to write code that detects attempts to connect to a SQL Server, and find them that way. A more obvious approach is to look for SQL Servers that can be seen and then look to see what DBs they have, that would be a ton easier. It won't tell you which DB belongs to which program, obviously.

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            M Offline
            M Offline
            mehrnoosh
            wrote on last edited by
            #5

            how can load the whole program as binary data?

            C 1 Reply Last reply
            0
            • M mehrnoosh

              how can load the whole program as binary data?

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              File.ReadAllBytes. Getting those bytes into strings that you can then run a regex on, is another matter. I guess you need to look for sequences that look like a string. I think the whole thing is a disaster. I assume you're assuming that the string is not in a config file, seeing as you're trying to hack into an existing program.

              Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              M 1 Reply Last reply
              0
              • C Christian Graus

                File.ReadAllBytes. Getting those bytes into strings that you can then run a regex on, is another matter. I guess you need to look for sequences that look like a string. I think the whole thing is a disaster. I assume you're assuming that the string is not in a config file, seeing as you're trying to hack into an existing program.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                M Offline
                M Offline
                mehrnoosh
                wrote on last edited by
                #7

                i cant undrestand you:confused: plese help me... i must write this program till this evening :( isnt there any other way?

                C 1 Reply Last reply
                0
                • M mehrnoosh

                  i cant undrestand you:confused: plese help me... i must write this program till this evening :( isnt there any other way?

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  Why do you have to write it this evening ?

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  M 1 Reply Last reply
                  0
                  • C Christian Graus

                    Why do you have to write it this evening ?

                    Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                    M Offline
                    M Offline
                    mehrnoosh
                    wrote on last edited by
                    #9

                    i must deliver it to my boss. i am a programmer and its a piece of our projects:confused:

                    C 1 Reply Last reply
                    0
                    • M mehrnoosh

                      i must deliver it to my boss. i am a programmer and its a piece of our projects:confused:

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      Your boss gave you one night to write something, but when it's explained to you, you can't understand the explanation ? Your boss is an idiot. I've explained every possible way to do this that I can think of, in the plainest possible language. I don't know what else to say.

                      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                      M 1 Reply Last reply
                      0
                      • C Christian Graus

                        Your boss gave you one night to write something, but when it's explained to you, you can't understand the explanation ? Your boss is an idiot. I've explained every possible way to do this that I can think of, in the plainest possible language. I don't know what else to say.

                        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                        M Offline
                        M Offline
                        mehrnoosh
                        wrote on last edited by
                        #11

                        i can undrstand you but i want just to know is there any other way? you are right... i am sorry... thank you for your help my good friend anyway:rose: :)

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups