0

I have spent about a day on this trying to figure it out but for some reason I can't locate the issue.

I am attempting to run this python from Kali

For some reason the query is returning no results. Am I missing something obvious?

CODE:

import _mssql
server = '192.168.1.83'
user = 'sa'
password = 'password123'

print 'connecting'
connection = _mssql.connect(server=server,user=user,password=password,database='WebApp')
print connected
sqlQuery = "SELECT * FROM dbo.users"
print connection.execute_row(sqlQuery)
print connection

OUTPUT

Connecting 
Connected 
Making Query 
None 
<Open mssql connection at 0x7fc1a954d6b0>

enter image description here

5
  • I wonder if the last two prints are correct. Please look at this, this Commented Sep 29, 2016 at 21:29
  • @techspider I've also tried putting it into a forloop and run over the rows but the forloop never enters Commented Sep 29, 2016 at 21:30
  • Can you login and issue the query using the osql tool without any issues? Is tcp/ip enabled? Commented Sep 29, 2016 at 21:38
  • @AnthonyRussell Oh, ok. I tried your code and it worked fine on my system, returning data as expected, the only issue was the print connected line that threw an error as connected wasn't defined. I'd check the network protocol configuration in the SQL Server Config Mgr to make sure the correct transport is enabled. Commented Sep 29, 2016 at 21:39
  • @jpw oh okay thank you for checking it Commented Sep 29, 2016 at 21:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.