-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type error: "a bytes-like object is required, not 'str'" #7
Comments
Some of the code comments point to this: Line 142:
|
Hi, I have a local copy that I've mashed up and
|
Replacing the header function doesn't work either:
Does your modified script work? and if so under python3.5? I set up under virtual environment for python 3.5 but the encoding/decoding issue remains. Can you share the entire script if it works for you? |
i think this is where that exception occurs: https://github.com/deralexxx/PySight2MISP/blob/master/PySight.py#L210 try changing this:
to this:
|
No luck there either:
New error for object type:
|
i made only that change to that github version, and it works for me. can you run the python debugger on this portion of the code and walk it through and see what's happening? if that part of the code fails, it can return a
|
Bool object is the issue now as you mentioned. Set the breakpoint for the block of code below:
Error below:
|
OK, there it is...
You need to |
So it progressed further once the debug directory was added:
installed libgcc next:
looked like it was connecting and downloading the i sight content then it complained about not being able to connect to my MISP instance, swapped the IP address of the instance with the alias version and reviewed the proxy details (same as in MISP instance):
MISP URL and proxy set as follows: (switched to misp_url=https;//127.0.0.1)
So close to getting it to run smoothly! |
I would think this is is coming from one of the |
Config.cfg
|
OK... You need real values in your
|
I have swapped those details naturally for the API keys for MISP and i Sight. No quotes used in those fields,
|
HA, ok... Gotta see why you are getting those parser inappropriate args. Correct: no quotes in |
Sure send on your script and I can test it. How does your config.cfg look? |
My config was greatly enhanced along with my code. Get that test script to connect to MISP, and then carry the settings you edit into the script into your |
hm strange issue, but I would be happy to get pull requests, I have to be honest that I have not used the script for a while. |
Run script and it connected:
Settings in script as follows:
So need to modify config.cfg to no pass proxy I suspect?:
|
Yes, give it a try. |
Proxy needs to be set for the i Sight connection but this seems to impact the MISP API connection. How should it be set for no proxy instead of 'None'
In any case, the script runs on the same server as MISP and is accessible using based your test connection script while when it is set in config.cfg it fails.
Any recommendations to sort this connection issue? |
Try...
|
No luck leaving the proxy values blank or appending "None". Same issue:
Are you make your requests through a proxy and how is it presented in the config? Interestingly, the initial connection to MISP works once launched:
|
sorry that i cannot share my code, as it was dramatically enhanced. unfortunately, i am not the author of this code (and i rvisdee it a long time ago, and there were some quirky parts). however, you can try modifying the from:
to something like the following. NOTE: if you're not using a proxy, then in
|
The isightAPI variable is unique to your code as not present in config or PySight script after adding your code segment:
Without digging too much into your code, what have you you set isightAPI as? Also, I have the proxy already set as global environment variable in /etc/environment on the server but the config script requires it as PySight won't run without setting those proxy values. |
Sorry about that... I am trying to take pieces of new code and apply it to you situation. Here's a correction, i.e. replacing
|
Interestingly, I can't test it now, getting this error since a terminal crashed and the existing session that was forcefully closed is still locked and any new call to libgcc is still referencing even after a reboot AND it is installed already:
Error:
This troubleshooting is neverending :) |
Ignored that libgcc error and inserted your code but further debugging needed; same error message from earlier "TypeError: 'bool' object is not subscriptable" but /debug directory exists:
|
OK, my typo. So sorry. This is what happens when I cannot really test my code :-( I had this line:
But should've been:
Here it is again in context:
|
That worked, this libgcc error is now persisting and really hampering the debugging:
It is installed:
|
OK, glad to hear your progress. Sorry, but I don't think I can assist re' the |
I would guess you are aware... just in case... You are saying you see this installed:
But the error is reporting a different library name is missing:
|
Had to install another package which worked (proxy issue still persists):
Ran the test_pysight script just to see if there was any other issues to help the troubleshooting:
|
I've never run Can you try running |
I was hoping for test_pysight to reveal something else. In any case PySight script can't find MISP instance despite setting proxy in the config. Does the proxy have to be set in PyMISP keys file too?
|
Do you need to connect to your MISP via a proxy or can go direct? The code that maks the connection in
|
So added proxies settings for MISP via PySight script and PySight settings script; the first was to PySight Settings added this:
Next I added to PySight.py:
This proceed to run but it just hangs and no error message is specified. |
Seems like this is now not a script issue, but rather related to network access. May I suggest you troubleshoot your network path from a shell through the proxy to your MISP host, e.g. using |
so seems you guys changed some stuff, do you mind to make a PR? Others might find it useful, I would really appreciate it, and apologise for not updating the script for so long |
I haven't tested it without the proxy settings as it was my intention to get it working with it. I will test without the proxy settings on a separate machine and if it works, will do a PR after. |
ok overall looks like in this issue, several issues are actually discussed and already solved (which is great) maybe we should make an issue for each of the problems and fix them? |
Any need to still do a pull request or has this been updated in the interim? |
Please do a PR. |
Pull Request made if you can review. |
Hey @faustus25 you created the pull requests to your own repository (Fork https://github.com/faustus25/PySight2MISP/pulls and you need to create the pull requests for https://github.com/jaegeral/PySight2MISP Thx |
Hi @jaegeral, I can only do a pull request of lgtm and not master: Can you check this? |
Hey, there is nothing I can check, but maybe this helps you: Thx |
But tbh, the one PR you made: https://github.com/faustus25/PySight2MISP/pull/2/files does not really change anything. The second PR you opened to your own repo: So please resolve those things before making a Pull Request. Thank you :-) |
Type error running Pysight.py under Python3:
Line 778-791:
Line 807:
Can you check if you encounter this issue?
The text was updated successfully, but these errors were encountered: