I created a request using scapy. It works fine with my eth0 interface. I send a message to the discoverer and i get an offer. But it doesn't work through the wlan0 interface, when I connect to it via wifi and try to send a packet.
Why is this happening ? How to fix it ?
from scapy.all import *
conf.checkIPaddr = False
dhcp_discover = Ether(dst='ff:ff:ff:ff:ff:ff',src=RandMAC()) \
/IP(src='0.0.0.0',dst='255.255.255.255') \
/UDP(sport=68,dport=67) \
/BOOTP(op=1, chaddr=RandMAC()) \
/DHCP(options=[('message-type','discover'),('end')])
#sendp(dhcp_discover,iface='eth0') # Ok
sendp(dhcp_discover,iface='wlan0') # not working
enter image description here
Related
I am able to send a command string to the serial port via Putty and get a response. However, when I try the same using Python PySerial read/write I am not able to send read/write commands.
Putty terminal:
example-1:
<command_string>
response = Success
Example-2:
<incorrect_command_string>
response = Fail
Python code:
serialData = serial.Serial(port=2, baudrate=921600, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
serialData.write(b'<command_string>')
print(serialData.in_waiting)
print(serialData.read(serialData.in_waiting))
Output of the code:
0
b''
Any suggestions?
Found it:
The response string has '\r'. So I am able to use read_until as below and eliminate the sleep.
serialData.read_until("\r".encode('utf-8'))
I am using the new sdk for the google assistant along with the new commands for it (python -m googlesamples.assistant.grpc.audio_helpers and python -m googlesamples.assistant.grpc.pushtotalk) it always passes the test but keeps coming up with this error when I try to use it.
C:\Users\oliverdavison>python -m googlesamples.assistant.grpc.pushtotalk
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: 'C:\\Users\\oliverdavison\\AppData\\Roaming\\googlesamples-assistant\\device_config.json'
INFO:root:Registering device
ERROR:root:Option --device-model-id required when registering a device instance.
You need to follow this guide to use the Actions console to register a device model id, after which you will use as a flag in your command line.
C:\Users\oliverdavison>python -m googlesamples.assistant.grpc.pushtotalk \
--device-model-id <my-device-model-id>
I want to monitor Azure Paas database with Nagios. I'm using this plugin available at https://github.com/MsOpenTech/WaMo
When I try to check database:
./check_azure_sql.py -u -p -d -k top5queries
I get this error message:
('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
Error connecting to database
All dependencies are installed (list in GitHub plugin site).
Here you can see my /etc/odbcinst.ini:
[ODBC]
Trace = Yes
TraceFile = /tmp/odbc.log
[FreeTDS]
Description = ODBC For TDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
UsageCount = 1
Here you can see my /etc/freetds/freetds.conf:
# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
; tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
# A typical Microsoft server
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
And my /etc/odbc.ini is empty.
Does anybody have any idea?
bhagdev, to do simple, i'm trying to monitor Sql database Azure Paas with nagios.
It's not me that is written the plugin available at github.com/MsOpenTech/WaMo. For a nagios admin, i only need to execute the command ./check_azure_sql.py -u (username) -p (password) -d (database) -k (key) (check_azure_sql.py written in python) from debian linux cli.
So when i execute the command above i get the error message :
('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)') Error connecting to database.
Than'ks for your help guy's
I need to send mails from my Python3 script. Now it does, but my gmail password is visible and I cannot trust in any admin of this machine, so the solution I see is to mount a local mail server. To do some tests, I was trying to execute a script (this one: SMTP sink server). While this one is running, I execute my old script with some changes:
import smtplib
# server = smtplib.SMTP('smtp.gmail.com:587')
server = smtplib.SMTP('localhost:25')
# smtp.ehlo()
# server.starttls()
# smtp.ehlo()
# server.login('my_account#gmail.com', 'my_password')
server.login(None, None)
server.sendmail('Me <my_account#gmail.com'>, ['to_user#gmail.com'], 'Hi!'.as_string())
server.quit()
I understand the script at the link will create a file in the folder where it is with the mail content, but nothing happens, because I get this error message:
SMTP AUTH extension not supported by server.
I googled and I think this could be sorted out if I uncomment the line server.starttls(), but it gives another error, which is supposed to be solved with the lines smtp.ehlo(), but not in my case.
Any suggestions?
OK, I managed to send the email, what I only had to do was removing this line:
server.login(None, None)
I am writing a Pyramid application that relies on gevent-socketio and redis. However, I noticed that when I navigate away from the view that establishes the socket.io connection, my application becomes unresponsive. In order to try and isolate the issue, I created another bare-bones application and discovered that using pubsub.listen() was causing the issue:
class TestNamespace(BaseNamespace):
def initialize(self):
self.spawn(self.emitter)
def emitter(self):
client = redis.pubsub()
client.subscribe('anything')
for broadcast in client.listen():
if broadcast['type'] != 'message':
continue
The way I'm starting up my application is as follows:
pserve --reload development.ini
However, I can only get my application to work if use use the serve.py from the examples:
import os.path
from socketio.server import SocketIOServer
from pyramid.paster import get_app
from gevent import monkey; monkey.patch_all()
HERE = os.path.abspath(os.path.dirname(__file__))
if __name__ == '__main__':
app = get_app(os.path.join(HERE, 'development.ini'))
print 'Listening on port http://0.0.0.0:8080 and on port 10843 (flash policy server)'
SocketIOServer(('0.0.0.0', 8080), app,
resource="socket.io", policy_server=True,
policy_listener=('0.0.0.0', 10843)).serve_forever()
Unfortunatey this is rather cumbersome for development as I lose --reload functionality. Ideally I'd like to use the paster integration entry point
Another thing I noticed is that the gevent-sockectio paster integration does not monkey patch gevent, whereas the examples server.py does.
How can I get pserve --reload to work with gevent-socketio?
I've uploaded my test application to github: https://github.com/m-martinez/iotest
Under [server:main] in your ini file.
use = egg:gevent-socketio#paster
transports = websocket, xhr-multipart, xhr-polling
policy_server = True
host = 0.0.0.0
port = 6543
If you get an error make sure you using the latest version of gevent-socketio.
With no success using egg:gevent-socketio#paster, I ended up using gunicorn with watchdog to achieve what I wanted for development:
watchmedo auto-restart \
--pattern "*.py;*.ini" \
--directory ./iotest/ \
--recursive \
-- \
gunicorn --paste ./iotest/development.ini
This is what my [server:main] section looks like:
[server:main]
use = egg:gunicorn#main
worker_class = socketio.sgunicorn.GeventSocketIOWorker
host = 0.0.0.0
port = 8080
debug = True
logconfig = %(here)s/development.ini