#πŸ”’ Receiving errors and don't know how to fix

71 messages Β· Page 1 of 1 (latest)

haughty osprey
#

I work with cyber security and I've been trying to implement some code from git that's supposed to automate many of the processes that help our machines be compliant with security standards. But upon attempting to run the code, I just keep receiving errors. These 2 specifically:
SyntaxWarning: invalid escape sequence '|'
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/root/includes/mscp-data.yaml'

So I did some research and found that the first error just needs something other than the I, so I changed it and that error went away but then I still had that other one. I did some research on yaml and I couldn't figure out how to install it, everything I tried failed. Then I found something that said I needed pip, so I installed pip via homebrew. I'm using macOS Sonoma.

There are so many files in git related to the one I'm using but I believe I only need to run a few to get the baseline image ready. Although I'm not entirely sure. I'm just a confused and need help on how to implement this code.

Any help is greatly appreciated. If you need the full code, let me know and I'll post it.

vestal gyroBOT
#

@haughty osprey

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

short chasm
#

Can you show the full traceback

haughty osprey
short chasm
#

And the code too

#

!paste

vestal gyroBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

haughty osprey
quasi rain
#

You're using an absolute path, did you meant use a relative path to the yaml file

haughty osprey
quasi rain
#

Obviously it can find it, either you can't access the folder or the file does indeed not exist

haughty osprey
#

I read something that said I need to install yaml or something, is that needed?

#

I can't get rid of that yaml error

quasi rain
#

Do you understand the error?

haughty osprey
#

I was thinking it meant I needed to install yaml. Seemed like it was saying it was looking for it and it's not there.

quasi rain
#

No, Python can't find the file at all

#

you are opening it with open(mscp_data_file)

#

but whatever path is in mscp_data_file does not exist

haughty osprey
#

Oh so maybe I need another resource on the git page I obtained the code from

quasi rain
#

Can you find it on the filesystem by hand, /private/var/root/includes/mscp-data.yaml

haughty osprey
#

I'll check now

#

oh it just stops at root, there is not includes folder

quasi rain
#

And that is what python is erroring on

#

The file you want it to open does not exist

haughty osprey
#

okay so I made the folder but how do I obtain the mscp-data.yaml

quasi rain
#

That's a good question which I can't answer for you.

#

You downloaded something, maybe only partially. Maybe you haven't configured it properly, whatever it is.

haughty osprey
#

maybe I'm misunderstanding how I'm supposed to download code from git. Can I show you the webpage I'm looking at?

quasi rain
#

Sure, post the url

haughty osprey
#

so what I did was download the generate_baseline.py file

versed bough
#

Is that file in another directory?

quasi rain
#

Usually you go to the releases page and download the archive from there and then extract it

quasi rain
#

MSCP_Sonoma_Rev_1.0.zip

haughty osprey
#

okay I'll try that

#

extract to where though?

#

does it matter

quasi rain
#

I have zero experience with this package, maybe it contains a README which explains how it works

haughty osprey
#

I read the readme files I could find, it didn't help me lol

#

where did you see the mscp sonoma rev zip file

#

I'm trying to find it

quasi rain
#

Under assets

haughty osprey
#

okay I have it, so now I should be good to try to run it again?

quasi rain
#

idk, no clue how this project works. But start with just extracting it somewhere and look for instructions

versed bough
#

@haughty osprey Are you just trying to generate the documentation?

quasi rain
#

Ah. dwd made me look a bit closer. It's one big document generator

#

the zip is just the result

versed bough
#

Yeah you can generate custom documentation presumably

haughty osprey
#

Sorry guys I got busy, currently at work. No I'm trying to run the code to implement the security measures. As far as I understand it, this code is supposed to automate a lot of the manual stuff we would otherwise need to implement.

versed bough
#

Ok well the code to implement the measures is not in that zip file.

#

Not that I can see anyways.

#

Yeah, it's all documentation.

quasi rain
#

Yeah. Most likely you need to get the Source.zip and then extract it

haughty osprey
#

damn, okay I'll try that shortly. still busy, I need to run to our photo department to fix something

quasi rain
#

In there is a scripts folder with to me look like command line tools to generate

versed bough
#

That still seems to just be to generate the documentation.

#

Perhaps from the xml you can write something to implement the rules programmatically but I'm not sure.

#

there are some other resources there that will perhaps make sense to you.

#

I hope that doesn't send you on a wild goose chase.

quasi rain
#

I am so not familiar with any of this lol

versed bough
#

It's for hardening macOS

#

@haughty osprey You could ask about it in #cybersecurity

haughty osprey
#

I'm still checking occasionally guys. Just busy with some photo printer issues at the moment.

haughty osprey
#

Thank you for helping.

vestal gyroBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.