Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Reverse engineer a closed source application that connects to sql server

$
0
0

Hi,
One of my friends have a closed source exe program written using .Net framework, this program connects to an sql server and search for records in multiple databases, unfortunately my friend wiped the computer and all he did was backup the .exe file and the database files (.mdf and .ldf) files.

Now I want to get the program working again by setting up the same environment as before he wiped the hard disk by installing sql server and importing the database

The problem is that sql connection information are hardcoded in the .exe file and I need them to set my sql server, what I did is that I usedStrings program from sysinternals and search for any clues about the connection information and I found these:

Provider=SQLOLEDB.1;Password=password@$%#$245;Persist Security Info=True;User ID=sa;Initial Catalog=twist;Data Source=pc
EData Source=pc;Initial Catalog=allinfo;User ID=sa;Password=password@$%#$245

so if I understand correctly the information are as follows:

user=sa
password=password@$%#$245
database=twist and allinfo
instance:pc

so I need to install sql server and set the user name and password as above and the instance name as pc ?

well I tried that and the program is still crashing when trying to connect to the sql server. So I have a couple of questions:

1- can I know the version of sql server that the program used to connect to (in case I installed the wrong version)?

2- Is the password that I got from the strings program encrypted and should not be used directly to setup sql server?

3- is my use of the above information correct ? some sources state that "Data Source" refers to the hostname not the instance!

How can I setup sql server to exactly accept connections from the program using the information above?

This is what I came up with
https://imgur.com/SYh9FGP

The errors I get are as follows

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The sercer was not found or was not accessible. Verify that the instanc ename is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider,error:40 - Could not open a connection to SQL Server)

and

See the endof this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** ExceptionText **************
System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQLServer does not exist oraccess denied.at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)at System.Data.OleDb.OleDbConnection.Open()at censored.Module1.insertincombo2013(Stringsql, Stringtable, DataGridView dgv)at censored.2013.Button1_Click(Object sender, EventArgs e)at System.Windows.Forms.Control.OnClick(EventArgs e)at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)at System.Windows.Forms.Control.WndProc(Message& m)at System.Windows.Forms.ButtonBase.WndProc(Message& m)at System.Windows.Forms.Button.WndProc(Message& m)at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    AssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.8800 (QFE.050727-8800)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll----------------------------------------
censoredAssemblyVersion: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/mohammad/Desktop/betaqa/id.exe----------------------------------------
Microsoft.VisualBasicAssemblyVersion: 8.0.0.0
    Win32 Version: 8.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll----------------------------------------SystemAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.8791 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll----------------------------------------
System.Windows.FormsAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.5491 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll----------------------------------------
System.DrawingAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.5495 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll----------------------------------------
System.ConfigurationAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll----------------------------------------
System.XmlAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.8773 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll----------------------------------------
System.Runtime.RemotingAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.8771 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll----------------------------------------
System.DataAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.8762 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll----------------------------------------
System.TransactionsAssemblyVersion: 2.0.0.0
    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll----------------------------------------

************** JIT Debugging **************
Toenable just-in-time (JIT) debugging, the .config filefor this
application or computer (machine.config) must have the
jitDebugging valuesetin the system.windows.forms section.
The application must also be compiledwith debugging
enabled.For example:<configuration><system.windows.forms jitDebugging="true" /></configuration>When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

PS:I'm a linux superuser and not a windows user that's why I know very little about Microsoft sql server and windows in general,I have experience in mysql but never used MS sql server before but I wanted to help my friend and I got blocked by my little knowledge.

Regards


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>