#unix

1 messages · Page 29 of 1

marble bluff
#

this is the right file right?

formal schooner
#

@marble bluff i've been told nobody has been able to break it yet, but i also wouldn't rely on it for testing malicious code

marble bluff
#

okay

warped nimbus
#

The one you linked was an internal command for staff only

#

snekbox is the public one

marble bluff
#

okay

#

thanks

warped nimbus
#

With nsjail you can set cpu and memory limits like you wanted

#

it uses cgroups

marble bluff
#

would it be preferrable over a docker?

#

for that matter, should i both have whitelist and sandbox the running or just sandbox it

#

theoretically the sandbox should be enough but i don't know that much about this process

warped nimbus
#

You could have a whitelist if you want. The way we did it was have nsjail mount the directory in read-only

#

which really solves a lot of potential security issues already

marble bluff
#

okay

warped nimbus
#

Maybe you could accomplish that in Docker? I dunno I haven't messed with limits for containers much tbh

marble bluff
#

so i guess i'll try that and just have input/output in sys.stdin and sys.stdout

warped nimbus
#

But NsJail would let you have way more fine grained control if you need it

marble bluff
#

okay, thanks for the tips!

warped nimbus
#

you're welcome

marble bluff
#

also, one last question (maybe)

#

should i use debian, arch, what as the base?

warped nimbus
#

We just use alpine images

#

Personally I'd be fine with debian too

#

I think they have images with smaller distributions of debian on docker hub somewhere

#

I also saw a tool in #303934982764625920 recently that helps you build your own minimal base image

marble bluff
#

any specific reasons for alpine?

warped nimbus
#

It's just what the official images on docker hub use

#

plus it's a very small image

marble bluff
#

okay

stoic hornet
#

I'm in CentOS 7 and I'm trying to create a bash script that launches a few of my python scripts in different screens.

Here is what I have so far :

    script1
    script2
    script3
)

script_names=(
    script1.py
    launch.py
    cook.py
)


len=${#script_names[@]}


for ((c=0; c<len; c++))
do
    echo "Starting ${screen_names[$c]}"
    screen -X -S ${screen_names[$c]} quit
    screen -S ${screen_names[$c]} 
    screen sh -S ${screen_names[$c]} -c 'python3.7 ${script_names[$c]}'
done```

I can get the screen to open but the python file often runs at the root and nothing happens in the screen
torn snow
#

Just as an FYI, screen has been abandoned for a few years now, check out tmux or dtach instead

stoic hornet
#

huh, thanks

worn apex
#

abandoned, really?

#

i knew it was old and a bit crusty but i did not know that

torn snow
#

basically between like 4 years there were no commits

#

despite bugs being found

#

right now there is a bit of activity since but no new release

#

so Red Hat straight up removed it from their repos

visual lark
#

We are running AIX, the gentleman who set our system up was told to install python 3.4.6 and python3.7. However he did this by replacing python 2.7, and only installed python3.7. To make things more interesting we asked him to install pip as well, as he installed the bare min he could.

I did not have access to this server until our main system went live, so I was unable to test it to ensure it was setup, or allowed to set it up myself. I don't know a lot about Unix or Linux, but know I could have installed them both easily. currently when we type pip3 it launches python37. We need to get python 3.4.6 installed to work with our installation of UniVerse, and I am needing Python 3.6+ in order to utilize a lot of my scripts that I have program and to lazy to convert back to 3.4.6.

Any suggestions on wiping python out so I can start over?

#

Its been an up hill battle since March trying to get it fixed. I been pulling all the data manually and running it within wsl, or windows depending on how it was programmed.

warped nimbus
#

Do you have python3.4 and python3.7 commands available?

#

They would be in typical python installs from my experience

#

And if you needed to use pip you could do python3.4 -m pip install ... for example

#

You weren't clear on what the actual problem was

visual lark
#

So 2.7 was wiped out

#

and python 3.7 was installed as pip3.

#

pip is no where to be found.

warped nimbus
#

Do you need 2.7 though?

visual lark
#

np

warped nimbus
#

pip is for python 2.x

visual lark
#

no

warped nimbus
#

So that guy didn't install Python 3.4, but you said you need it. But I don't see the problem there. Can you not just go ahead and install it yourself now?

visual lark
#

yes i suppose so

#

so the pip3, did the guy just rename python37 to pip3?

#

I mean i know you can see my install or anything

warped nimbus
#

Hmm? I was thinking you just were miswording things

#

Are you actually saying that the python executable is named pip3?

visual lark
#
Collecting pip
  Downloading https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d
17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl (1.4MB)
    100% |################################| 1.4MB 3.1MB/s
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
Could not install packages due to an EnvironmentError: [Errno 13] The file acces
s permissions do not allow the specified action.: '/opt/bin/pip3'
Consider using the `--user` option or check the permissions.```
#

yes

warped nimbus
#

Does AIX depend on python in any way?

#

Other distros do and removing it can bork things like your package manager for example

visual lark
#

Not sure to be honest, we are Using Rocket Software's UniVerse and UniData,

warped nimbus
#

If it didn't come with 3.7, and 2.7 was removed without noticeable issues, then it may be alright

#

Ah so pip3 is just a symlink to python3.7

visual lark
#

guess so

warped nimbus
#

does python3.7 -m pip --version work?

visual lark
#

no

#
ksh: python3.7:  not found.```
warped nimbus
#

try /opt/bin/python3.7 instead

visual lark
#

also its installed in opt/lib, is that normall?

warped nimbus
#

maybe that dir isn't on your path

visual lark
#

normal*

#

/opt/lib/python37.zip
/opt/lib/python3.7
/opt/lib/python3.7/lib-dynload
/opt/lib/python3.7/site-packages```
#
/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java7_64/jre/bin:/usr/j
ava7_64/bin:/opt/psforms/bin:/bin:/usr/bin:/etc:/usr/informix/uv/bin:/opt/psform
s/bin
$```
warped nimbus
#

Yeah I suppose it's alright that its there

#

According to the other pic you showed the symlink was to /opt/bin/python3.7

#

so try the command I showed again but specify that absolute path to the binary

visual lark
#

so he installed it multiple places?

warped nimbus
#

No

visual lark
warped nimbus
#

the binary is in /opt/bin and the things like the standard library files are in /opt/lib/

visual lark
#

ok

warped nimbus
#

so does /opt/bin/python3.7 -m pip --version work?

#

or do you get a module not found error?

visual lark
#

pip 10.0.1 from /opt/lib/python3.7/site-packages/pip (python 3.7)

warped nimbus
#

ok so it does have pip

visual lark
#

kk

warped nimbus
#

Honestly I'm not sure how you could fix the pip3 command (well you could start by removing the symlink)

#

but you can just be a bit more verbose in the command and you'll get pip to work that way

visual lark
#

never messed with symbolic links on unix or linux just windows

warped nimbus
#

With the command I showed above

#

If you were to install python 3.4 side by side then you'd need to run pip like that for one of the versions anyway because IIRC version-specific pip commands are not added unlike the python command itself

visual lark
#

alright ill check into it.

#

thanks

visual lark
#

So it looks like there is a lot of symbolic links here, all the -> correct. I can freely delete these? As for pip3, i still haven't figure out why its going to python3.7

warped nimbus
#

You could but why would you?

#

also it doesn't look like pip3 is a symlink anymore

visual lark
#

thats in opt/bin

#

the pip3 when i call it came from somewhere else

#

that one is actually pip3

#

Usage:
  pip3 <command> [options]

Commands:```
#

would adding opt/bin to path be wise?

warped nimbus
#

Yeah I'd add it

#

So you have a pip3 binary and then also a pip3 somewhere else that's incorrectly symlinked?

visual lark
#

yea python3.7 is named pip3 in a different directory

#

alright, my office is being locked up and i don't want to set the alarm so I am out of here. Ill probably be back tonight or tomorrow to look into this more. I think I know what needs to be done.

livid forge
#

make sure you add it to the front of your path

#
export PATH=/opt/bin:$PATH```
visual lark
#

Why the front?

#

So it has higher priority i am assuming?

warped nimbus
#

Yes, exactly

visual lark
#

Thanks

visual lark
#

So we didn't end up adding it to export. as they are a bit touchy with commands they don't use often. Though I showed how it works in WSL with no issues, and that it just added it to the front of $PATH. However we got our 3.7 working and we have 3.4.6 working

#

So thanks everyone

visual lark
#

Okay so now we tried installing paramiko with pip3 and got this error message about a directory called xlc_r not existing

#
          the compiler from Python's standard "distutils" module.  See
          the error messages above.  Likely, the problem is not related
          to CFFI but generic to the setup.py of any Python package that
          tries to compile C code.  (Hints: on OS/X 10.8, for errors about
          -mno-fused-madd see http://stackoverflow.com/questions/22313407/
         Otherwise, see https://wiki.python.org/moin/CompLangPython or
          the IRC channel #python on irc.freenode.net.)```
warped nimbus
#

I'm not familiar with AIX. xlc seems to be IBM's proprietary compiler, which needs to be purchased separately?

#

Maybe you already have it but it's just not on your PATH

#

If you don't have it then you can look into getting a free compiler to work like GCC

visual lark
#

whats GCC?

#

compiler for c++

#

?

sage solar
#

gcc is the gnu compiler collection, its a compiler collection for maaaaany languages including c++

visual lark
#

thanks

shrewd isle
visual lark
sage solar
#

what OS are you on?

visual lark
#

AIX 7.2 i believe

#

might be newer

#

yea 7.2

visual lark
#

Not sure if this will cause any issues with our system, but I don't believe it will. We are using UniVerse by Rocket Software.

visual lark
#

Thanks

#

Hardest part is, i can't get them to let me install anything unless I have everything perfect for the install and know it wpm

#

won't affect our server.

warped nimbus
#

I understand

#

Perhaps you can circumvent the need for a compiler for now

#

Packages may come with manylinux wheels

#

I wonder if manylinux wheels work on AIX

#

I would have expected pip to try to use the wheel by default, but I honestly don't know how it it really does have such behaviour

#

You can see the wheels here for various versions of Python

#

and you should be able to do pip install blah.whl to install it

#

instead of trying to build cffi from source, which requires a compiler

#

It may not work though since I believe manylinux wheels are built with GCC but AIX uses xlc

visual lark
#

I am fairly certain the person who installed python37 originally did it some stupid way and thats why we are having issues

#

awe

warped nimbus
#

Maybe your initial issues sure. But needing a C compiler to build certain packages is fairly common

#

It's not related to how Python was installed

visual lark
#

k

warped nimbus
#

Needing a C compiler is a separate issue

#

I would say you may be at a disadvantage cause you're on AIX and it uses xlc

#

So you may not be able to take advantage of wheels

#

manylinux ones specifically

visual lark
#

Any thoughts on how I would get paramiko installed?

warped nimbus
#

Presumably paramiko has a dependency on cffi

#

So you need to get cffi installed

#

cffi is a c extension for Python so you need a c compiler for it

#

or you need to find it precompiled somewhere (a wheel)

visual lark
#

ok

livid nebula
torn snow
#

now you can say you use arch btw

white solar
#

@livid nebula
Is that gnome?

visual lark
somber stirrup
livid nebula
#

@white solar yea and it virtual machine looking to get laptop for arch have any suggestions for a desktop environment that is easy to set up I'm looking at mate

main olive
#

@livid nebula KDE plasma

#

0 set up

marble bluff
#

iand it looks nice

#

go kde!

#

jk

#

but it was the first desktop i've ever used and its awesome

warped nimbus
#

How can I gunzip all files in a directory, but have their destination be somewhere else?

#

Do i have to write a shell script for it?

#

I know it has -r but I dunno how to specify a destination

#

the typical way with a single file is gunzip -c file > /dest/

formal schooner
#

doesnt gunzip have a "directory" option? like -d or something

#

yes you'd write a shell script, or at least a more "extended" command

#

huh i guess gunzip doesnt, i think unzip does

#
for gz in downloads/*.gz; do gunzip -c "$gz" > src/"$(basename "$gz" .gz)"; done

something like that

#
find downloads/ -iname '*.gz' -type f -exec gunzip -c '{}' \> 'src/$(basename {} .gz)' \;

yuck... that might work too

worn apex
#

"$(basename "$gz" .gz)"

formal schooner
#

^ that

worn apex
#

i'd probably include the src/ in the outer quote, but that's stylistic

#

does find -exec support redirection?

formal schooner
#

i have no idea

#

probably not actually

worn apex
#

nope

formal schooner
#

i assume it uses the exec syscall and not the shell

#

so $() wont work either

worn apex
#

it just sends the > as an argument, you'd need to start a shell explicitly

#

and getting {} in the middle of a string is even more of a hassle

#

-exec sh -c 'gunzip -c "$1" > "src/$(basename "$1" .gz)"' _ {} \;

formal schooner
#

if you use zsh its a little shorter

for gz in downloads/*.gz; do gunzip -c $gz > src/${${gz:t}/%.gz/}; done
#

what is _ there @worn apex ?

worn apex
#

the first argument after sh -c ... becomes $0

#

which is normally the script name, as its "argv[0]" eqivalent

formal schooner
#

TIL

worn apex
#

i suppose you could just use it, but it gets trickier with exec + because it doesn't get included in $@

formal schooner
#
-exec sh -c 'gunzip -c \{\} > "src/$(basename "$1" .gz)"' \;

would that work

#

err wait no

#
-exec sh -c 'gunzip -c "{}" > "src/$(basename "$1" .gz)"' \;
worn apex
#

i'm not sure I'd trust it

#

what if the filename contains quotes or other special characters

#

(I didn't think find could do it at all, but apparently I'm wrong at least about GNU find)

#

If a utility_name or argument string contains the two characters "{}", but not just the two characters "{}", it is implementation-defined whether find replaces those two characters or uses the string without change.

#

but it doesn't do anything special with quotes, so that'd be a problem

formal schooner
#

the answer is, "use zsh"

#

or i guess you can write the move-file script to a separate file

#
echo -e $'#!/bin/bash\ngunzip -c "$1" > "src/$(basename "$1" .gz)"' > unzip-to.sh
find directory/ -iname '*.gz' -exec ./unzip-to.sh '{}' \;
warped nimbus
#

ty

brazen urchin
#

hey gius

#

guys*

#

I was wondering what environment setup he gots here

#

it looks like vim and tmux

#

but his commands doesn't work on my terminal for some reason

#

for editing and stuff like that

livid nebula
#

Hey I have a Chromebook c720 and am installing arch Linux on it. I know the wifi driver I need just can't figure out how to enable it.

warped nimbus
#

Give me your terminal emulator recommendations. Looking for something lightweight. I don't need tiling or tabs because I don't see why my window manager can't handle those jobs. st would be appealing if it had some more basic features like scrollback and copy/paste (I've found forks which have those) but the way it is configured (recompiling) is unappealing to me. Also some of the bugs on the issue tracker put me off.

sage solar
#

Alacritty!

warped nimbus
#

wow I was not expecting to get an actually good recommendation

#

no offense to everyone here

#

I'm gonna try this out

robust cave
#

Alacritty is lightweight? 0.o
I personally use kitty, it does have tiling and tabs functionality though so some might ermagerd bloat

warped nimbus
#

I use tilix currently and it was fine

#

but yeah I am just thinking about bloat

#

why do I need to use software with so many features I don't need anymore

#

st was like halfway there but its a bit too barebones

#

which is a shame

robust cave
#

if you end up trying alacritty let me know if you run into anything buggy, it’s one of the things discouraging me from trying it out

#

also speaking of many features I don’t need anymore, an i3+kitty+neovim setup let’s me have splits in tabs in splits in tabs in splits in tabs...

warped nimbus
#

I'll be running the same thing except I haven't decided on a terminal yetr

#

I just don't see the point in tabs and tiling when you're already using a window manager than can tile for you

#

maybe some people may like tabs? but I don't see the point

robust cave
#

I haven’t benched anything, just speculating, but would it be faster/less memory consumption if you use the terminal's own splitting/tabbing vs creating a new separate process?

warped nimbus
#

Maybe not if the terminal has some sort of daemon

#

but these lighter weight terminals probably leave it out

#

I'm not concerned about system resources as much as I am about the performance of actually using it

#

I am guessing the latter wouldn't change with how many processes of it you had unless it ends up impacting system resources heavily

#

which I don't see ever really happening to me

robust cave
#

yeah, alacritty and kitty both offload rendering to the GPU though so if you end up trying both, do share your experience

warped nimbus
#

just installed it so we'll see

#

I'll probably stick with it for a bit. I really wanted to make st work but the effort into configuring it felt off putting if there was the chance I'd end up just dropping it

#

But alacritty feels like less of an investment

#

also I need a better nvim theme cause I am realising this is quite awful with its grey-ness

#

maybe just changing the bg colour will do it

robust cave
#

is that vim-one?

warped nimbus
#

yeah

#

I put like 10 minutes into configuring it total

robust cave
#

I’m using that too, I think the background uses the terminal emulator's background? because mine isn’t as dark as yours

warped nimbus
#

Yeah you're right it does do that

#

I've been having trouble staying motivated to do this

#

All the time I've devoted to making the switch today has been deciding which terminal emulator to use lol

#

just get overwhelmed and do other stuff instead

robust cave
#

just configure stuff one at a time, I get that too sometimes

warped nimbus
#

I'm definitely going way out of my comfort zone

robust cave
#

I still have lots to do on my laptop but I’ve been putting it off

#

that’s good though

warped nimbus
#

I think you were wrong about vim using terminal's bg colour

robust cave
#

hm, how does it work then? I didn’t research because I didn’t have any issues 😅

warped nimbus
#

Just seems to be defined by whatever theme you use

#

like :hi group ctermbg=whatever

#

the colour schemes just have a bunch of highlight commands

robust cave
#

okay, so the error was my assumption due to the fact I’m using the same colours for my terminal emulator and the vim colorscheme I’m using

warped nimbus
#

kind of a pain since I don't even know what groups to edit

robust cave
#

how did you install the vim colorscheme?

warped nimbus
#

with vim plug

#

I think

#

let me check

#

yeah with vim plug

robust cave
#

do you set termguicolors?

warped nimbus
#

yes

robust cave
#

hmm

warped nimbus
#

I want to see how it'd look if the window was semi transparent

#

just set it to black and like 70%

#

Maybe that's something I need to do in i3 instead

#

But not sure cause then I'd need to manage exceptions (e.g. don't want my web browser transparent)

robust cave
#

what's $TERM?

warped nimbus
#

xterm-256color

robust cave
#

you’re not using tmux right?

warped nimbus
#

I am not

#

Do you really think the bg is not being set by the vim theme?

robust cave
#

I’m not sure, I installed alacritty on my machine, and neovim's background does show correctly to the lighter grey

warped nimbus
#

Alacritty's background is black by default

robust cave
#

yes, but when I open neovim the background shows up

warped nimbus
#

right then it means like I said, it is not dependant on terminal bg

robust cave
#

yep
The way I set my theme is

syntax on
set termguicolors
colorscheme one
set background=dark

is yours any different?

warped nimbus
#

it's the same

#

well also this let g:airline_theme='one'

#

I checked the colour code and the bg is the same as the one in their screenshots

#

Kinda baffling they would choose these colours

#

well, barely

robust cave
#

no yeah comments are that dark for me too, I was partially blind
I haven’t found a nicer scheme yet though

#

maybe it’s time to make my own

warped nimbus
#

You can customise it

#

It has a config function which basically replicates highlight

#

I'm gonna look into that later

brazen summit
#

When we do sudo systemctl restart gunicorn-service does it gracefully reload it? Or is there any downtime? I am hosting a new website, its my first time with Gunicorn, have been using uWsgi in past. So i dont know about it, i need no downtime when I launch my site with traffic.

south star
#

i think restart implies downtime, check if there is a reload or graceful command

#

reload usually means only reloading the conf, without stopping

torn snow
#

@brazen summit restart completes stops and starts the service (by default it sends a SIGINT to stop it IIRC), so yeah there will be downtime

#

It'll be very short but present

#

systemctl reload sends a SIGHUP instead, which many processes interpret to just reload the configuration, which may be what you want provided gunicorn handles it

brazen summit
#

ah thanks!

main olive
#

Has anybody tried to view app cached images in linux?

#

It's easily done on windows, but on linux apparently files apparenly got extra layer of encryption?

main olive
#

@main olive elaborate?

#

@main olive It is possible to inspect discord images stored in a cache, even after they are deleted via the app with api call

#

They are extensionless files on windows, and all you are required to do to view them is to convert them to .png

#

discord, the client?

#

yes

#

the client

#

point being, on windows it is easy

#

whereas on linux quite complicated

#

do you have a file you've grabbed on linux at hand?

#

couldnt find any info online

#

yes

#

run file on it

#

does it say it's just "data"?

#

yes

#

well then

#

tried converting to any formats it won't work

#

also, when i do open up the file with text editor

#

i mean i see so much encoded stuff but also some unencoded urls

#

http responses

#

can you do hexdump -C [file] | head on it and post the output?

#

including the whole url for the file, which is not accessible anymore

#

sure

#

I've done it, but it contains a url

#

🤔

#

post it

#

sec

oak shell
#

I think @sage solar tried that too some months ago. We didn't find out how it works IIRC.

main olive
#
00000010  40 e7 fa 72 00 00 00 00  68 74 74 70 73 3a 2f 2f  |@..r....https://|
00000020  6d 65 64 69 61 2e 64 69  73 63 6f 72 64 61 70 70  |media.discordapp|
00000030  2e 6e 65 74 2f 61 74 74  61 63 68 6d 65 6e 74 73  |.net/attachments|
00000040  2f 35 37 32 38 32 33 31  31 31 31 39 36 37 33 37  |/5728231331196737|
00000050  35 36 33 2f 36 30 38 33  33 33 31 33 36 35 33 34  |563/308333136534|
00000060  39 36 32 31 39 36 2f 69  6d 61 67 65 30 2e 67 69  |962296/image0.gi|
00000070  66 3f 66 6f 72 6d 61 74  3d 70 6e 67 26 77 69 64  |f?format=png&wid|
00000080  74 68 3d 33 30 30 26 68  65 69 67 68 74 3d 33 30  |th=300&height=30|
00000090  30 89 50 4e 47 0d 0a 1a  0a 00 00 00 0d 49 48 44  |0.PNG........IHD|```
#

i am not too keen on insides of the files, such as images and all, but are they even supposed to contain urls when viewing with text editor?

#

huge portion of the file is encoded or maybe even encrypted

warped nimbus
#

It can contain anything discord wants it to contain

main olive
#

interesting

#

I'll look at this tomorrow

warped nimbus
#

it doesnt look like it's directly an image format

main olive
#

location where you're getting these from?

#

but the size of the file varies depending on extension of the cached thing itself, gif's are like 300 lines long, whereas regular api calls like avatars are less than a hundred

#

@main olive ~/.config/discord/Cache

#

on the user that has discord installed obv

#

neat, I'll have a look tomorrow, try REing the logic and report back

#

thanks man

#

@sage solar any ideas?

sage solar
#

I tried what some month ago

#

I can't recall trying to read images from caches

#

At all

#

Not even having the idea of doing that, sorry @main olive

nimble trail
#

How do you pronounce "chroot"?

warped nimbus
#

c h root

nimble trail
#

I'd been going with Chi Root, but then I encountered schroot and my brain broke trying to pronounce it.

sage solar
#

Chroot is short for change chroot so just ch as in change + root

main olive
#

it's pronounced "groot"

sage solar
#

I am chroot

#

That'd be a great honey pot response

main olive
#

@main olive Checked the average lengths of the files in bytes for each extension it has included inside.

Average length of .jpg file is: 13072.95703125
Average length of .gif file is: 36290.333333333336
Average length of .mp4 file is: 16322.876325088338```
#

is it even possible that gif takes up more space than mp4

#

for Cache folder that is

warped nimbus
#

yes gifs can be huge

#

I don't see why that would change for the cache

main olive
#

@warped nimbus so all the values look normal to you?

warped nimbus
#

I wouldn't necessarily say normal since I don't know how the images are being stored in this format, but seeing this wouldn't raise any suspicions

main olive
#

@warped nimbus is it even highly possible that linux and windows could have completely different ways of storing cache. Why would discord do that

warped nimbus
#

I don't know. I'm just going off what information you've given us

#

Have you considered comparing the same exact cached file on windows vs on linux?

#

Do you see any resemblance of like a PNG header inside the files?

main olive
#

@warped nimbus i am checking it right now

#

so much resemblance

#

There is a noticable pattern

#

but when i sort of correct linux file to match that pattern on windows

#

and transfer it to windows

#

it doesnt load it

#

although the format matches

boreal kestrel
#

xxd > hexdump

#

Are ya'll talking about the Discord desktop client?

main olive
#

yes

boreal kestrel
#

I use Discord in Firefox. I wonder if its data cache is meaningfully different

main olive
#

are you on linux

boreal kestrel
#

I am

main olive
#

well go ahead and check

#

then

boreal kestrel
#

No idea how. I'm not exactly a web dev lol

#

Where would Firefox store cache like that? Under user data?

main olive
#

try ~/.cache/mozilla/firefox

boreal kestrel
#
drwx------ 7 keithb keithb 4.0K Aug  6 15:44 n9rkqdzb.default-1505854938711
drwx------ 7 keithb keithb 4.0K Aug  2 14:28 wn279iff.default-release
main olive
#

@boreal kestrel are you good at image files

boreal kestrel
#

I wrote a spec once 15 years ago from a reverse engineered image container format

main olive
#

how come i see different symbols when using same text editor in linux/windows both set up to use utf-8

boreal kestrel
#

different fonts, different parsing

main olive
#

i guess

boreal kestrel
#

realistically you don't want to touch binary data with utf8 encoding

main olive
#

i can see both IDAT and IEND

#

on both linux and windows, meaning those files do contain images

#

but for some reason only windows manages to convert them corectly

#

when adding the right extension to the file

#

in order to view it

boreal kestrel
#

Tried poking around in PIL/pillow?

#

It has native support for PNG data

main olive
#

you mean python libraries?

boreal kestrel
#

yeah

main olive
#

I have literally only worked with those once

boreal kestrel
#

poke around in the Image.load() Image.open() reference

main olive
#

sec mate

#

do i pass the file with extension?

#

because originally they dont have any

boreal kestrel
#

linux has no concept of extensions

main olive
#

understood

boreal kestrel
#

pass it the file path

main olive
#

got it

#

nah

boreal kestrel
#

However, for info, here's a hex dump from an actual PNG file which I could view:
xxd 443e0b9d71bea893105dade8e907e5c1.png | head <-- xxd is an awesome hexdump tool, I use it almost every day. also the image is "small" but has thousands of hexdump-lines, so head shows just the first 10 lines output

00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
00000010: 0000 0118 0000 00be 0806 0000 00ee bc10  ................
00000020: cb00 0020 0049 4441 5478 9cec bd67 7423  ... .IDATx...gt#
00000030: f979 e6ab 2ff7 eeb9 7b76 d70a b6e5 b565  .y../...{v.....e
00000040: 69ba d989 dd6c b299 90c1 0a40 2114 3250  i....l.....@!.2P
00000050: 4081 0580 0008 1448 0004 d800 53b3 c926  @......H....S..&
00000060: bb7b 3a4e e8e9 093d 7946 9334 1a8d 4633  .{:N...=yF.4..F3
00000070: b265 85f1 d8b2 2cdb 2bc9 96bc f6da 67bd  .e....,.+.....g.
00000080: d7e9 782d af9c 641f 5faf efee ddd1 6a9e  ..x-..d._.....j.
00000090: fba1 020a 81a1 2339 3de0 39ef 0189 aafa  ......#9=.9.....

It looks to me like the URL in the dump you provided would likely indicate it's a custom format.

main olive
#

it won't identify image

#

your does start with .PNG

#

as it should right?

#

i tried deleting that part before PNG

#

didnt help

boreal kestrel
#

Discord likely has a custom format with their own header information to include the URL and likely a checksum too

main olive
#

yes it does

#

but only on linux

boreal kestrel
#

That's odd.

main olive
#

i have inspected cache files on windows

#

they didnt have any normal looking

#

headers

#

incuding urls

#

so what do i do

#

the format is clearly almost the same as in windows

boreal kestrel
#

echo -n 'https://cdn.discordapp.com/avatars/128181551472050176/279dc3abe62c43856062e3fd4901a821.png?size=128' | wc -c

#

= 99

warped nimbus
#

The windows cache files don't have proper image headers either?

boreal kestrel
#

your 0x63 is likely the url length

warped nimbus
#

But it still figures it out?

boreal kestrel
#

which means you should be able to open the file in binary mode and skip ahead that many bytes

main olive
#

@warped nimbus yes

boreal kestrel
#

from there you could hand off the file object to PIL for it to load from there, or you can read the rest of the content as image data

main olive
#

unless changing the format of file strips out some parts

#

which i would assume it shouldnt

warped nimbus
#

no the extension does absolutely nothing to the data inside if that's what you're asking

main olive
#

well

#

yes

#

then

boreal kestrel
#

Why go through the trouble? They likely directly-appended the PNG data. I wouldn't be surprised if one of the fields even describes how long the PNG data is

main olive
#

windows doesnt have proper headers then

warped nimbus
#

What image viewer program do you use?

boreal kestrel
#

Windows doesn't have a lot of proper things. But this isn't a Windows problem 😃

warped nimbus
#

You could be right that they just appended the image data

#

you'd just need to find where it starts and ends

main olive
#

i already tried to get rid of that data

#

my linux file basically matched

warped nimbus
#

Though if that was the case you should be able to see huge chunks of similar bytes across platforms

main olive
#

the one on windows

#

but it still wouldnt load it

#

on neither linux or windows

#

i tried many image viewers

#

i will give an example

warped nimbus
#

Can you try to extract the PNG chunks and the prepend a proper header?

main olive
#

i already have the header on linux file, which i displayed above with xxd, windows file on the other does not have that header

#

so why prepend

warped nimbus
#

Ok I didn't know that

#

So what's missing from it compared to a normal png file?

main olive
#

normal as in the one that's working?

warped nimbus
#

Normal as in not even a cache file

#

just a plain old png you saved from wherever

#

Like if you look at the PNG spec and then look at what data you have, what does the spec have that you don't?

#

All it needs is a header plus three chunks IHDR IDAT and IEND

#

You said IDAT and IEND exist

main olive
#

okay actually i guess it was not related to that at all

#

might be just Kali problem

#

because i literally just had test.png image that was displaying just fine

#

i deleted extension

#

then added it back

#

and sure the thing doesnt work anymore

#

which it would on windows

#

i dont understand why

#

@warped nimbus you said extension does not matter

boreal kestrel
#

Linux doesn't have any concept of file extensions. Any program which uses a seen extension is malformed

warped nimbus
#

could be that your image viewer program relies on extension somehow

#

but in terms of the data in the file, that does not change

boreal kestrel
#

The file itself should have plenty of information in the content of the file to determine its file type. Where the content is not enough, programs rely on the user to tell it the content type.

warped nimbus
#

yeah that's why things like headers and magic numbers exist

boreal kestrel
#

So for PNG files, that's what the header does. The 0x89 followed by PNG.

#

JPG files have their own unique header

#

Gzip-compressed files have their own unique header. 7z has its own. Tar has its own. Well-built scripts have their own too

#

If you're saying that you removed the .png from the name of the file and then a program failed to load it, then I'm saying that program is broken and you should use a better one. 😃

main olive
#

ye, actually just tried another file and it didnt affect it

#

god damn it

#

okay well it must be the problem with headers

boreal kestrel
#

cat example.py

#!/usr/bin/env python3

import sys, struct
with open(sys.argv[1], "rb") as f:
  f.read(8) # skip unknown 8 bytes. probably checksum
  f.read(4)  # skip unknown 4 bytes. probably versioning.
  lenbytes = f.read(4) # apparently these 4 bytes are len. we'll use struct in a bit.
  f.read(4) # more unknown bytes
  f.read(4) # lol more unknown bytes
  # f is now at the URL start.
  urllen = struct.unpack("i", lenbytes)[0]
  # f.seek(urllen, 1) # from_what == current position
  f.read(urllen) # for some reason, I can't seek. oh well, just read and ignore.
  #
  # f is now at the raw image bytes
  print(f.read())

Then:
python3 ./example.py <(xxd -r -p <(echo -n "305c72a71b6dfbfc050000006300000085cfbc680000000068747470733a2f2f63646e2e646973636f72646170702e636f6d2f617661746172732f3132383138313535313437323035303137362f32373964633361626536326334333835363036326533666434393031613832312e706e673f73697a653d31323889504e470d0a1a0a0000000d4948445200000080000000800806000000c33e61cb00002000")) | xxd

00000000: 6227 5c78 3839 504e 475c 725c 6e5c 7831  b'\x89PNG\r\n\x1
00000010: 615c 6e5c 7830 305c 7830 305c 7830 305c  a\n\x00\x00\x00\
00000020: 7249 4844 525c 7830 305c 7830 305c 7830  rIHDR\x00\x00\x0
00000030: 305c 7838 305c 7830 305c 7830 305c 7830  0\x80\x00\x00\x0
00000040: 305c 7838 305c 7830 385c 7830 365c 7830  0\x80\x08\x06\x0
00000050: 305c 7830 305c 7830 305c 7863 333e 615c  0\x00\x00\xc3>a\
00000060: 7863 625c 7830 305c 7830 3020 5c78 3030  xcb\x00\x00 \x00
00000070: 270a                                     '.
#

That would demo how you could parse that weird header. Good luck figuring out what the other fields are tho. They're probably important.

#

Since I don't have your weird image file on my machine, the <(xxd -r -p <(echo -n "vomit")) takes your hex dump you screenshotted and turns it back into a readable file

#

but the data from the last f.read() should be able to be saved to a new PNG file. Or directly loaded by something like pillow

main olive
#

why won't just image work when i get rid of headers

#

they are not important, since windows images dont appear to have them sometimes

boreal kestrel
#

How are you getting rid of the headers?

main olive
#

text editor?

boreal kestrel
#

there's your problem

#

text editors are not meant for editing binary data

main olive
#

what is then?

boreal kestrel
#

When I was doing stuff on Windows with binary data files, I found Breakpoint Software's Hex Workshop to be awesome.

#

I really wish it were available for Linux. I'd renew my license then.

main olive
#

it parses the headers

#

and then?

boreal kestrel
#

Does it? It really hacks around the header

#

But the last f.read() should give you all of the raw image which you could save to a new file

main olive
#

i see

#

so by editing you mean reading bytes in hex?

boreal kestrel
#

right

#

Out of curiousity, what text editor do you use? On Windows I use Notepad++ to great effect. But again, not for binary data! On the linux side of things, I just use vim

main olive
#

atom

#

vim is great

#

but honestly its so intimidating for beginners

#

so i ditched it

#

within a week of using

#

I am aware that it's the most powerful

#

and all

#

I just found out about hexedit on debian

boreal kestrel
#

I forced myself to learn vim. There's a web game which helps some people learn vim, https://vim-adventures.com/

main olive
#

yes i am aware

#

@boreal kestrel so could i just delete the headers?

#

the PNG bit that specifies the extension is not a part of the header

#

so why keep them

boreal kestrel
#

Could you? What do you define to be the header?

#

Can you select only what you're considering deleting?

main olive
#

based on that

boreal kestrel
#

Yeah so if you delete everything up-to-and-excluding the PNG header, I would be surprised if the image didn't load after that

main olive
#

PNG is not a header

#

its part of the Size(12)

#

whatever that refers to

#

but it aint the header is it

boreal kestrel
#

You are incorrect. The .PNG is part of the PNG header.

main olive
#

so everything until IHDR is a header?

boreal kestrel
#

Right, but don't delete that.

#

It's part of the PNG image data.

main olive
#

i get it

#

so what do i do

#

the part of header before PNG is whats causing the error

boreal kestrel
#

Only you can do what you want to do, I think I've given you an answer already.

#
[10:14 PM] kinguard: its part of the Size(12)
[10:14 PM] kinguard: whatever that refers to

Size(12) is the Size field and indicates that the bytes in the example represent a value of 12 for the size field.

#

12 in hexadecimal is C, which you can see in the image as x0C

main olive
#

okay just off topic for a sec

#

-rw-------

#

what sorta permission is that

#

what about the user and others

#

wait

#

nvm

#

it just flew right out of my head that it simply means they have no permissions

boreal kestrel
#

😃

main olive
#

i've been on this image thingy for too long

#

head is melting

#

how come i can view the image

#

then

#

and also edit it

boreal kestrel
#

what do you mean?

main olive
#

i am not on root

#

nor am i using sudo

boreal kestrel
#

who owns the image?

main olive
#

😔

#

sorry

boreal kestrel
#

it's okay

#

I went from Mac OS classic to Windows. That was fun. Then Windows to Linux. That was hard. There's a ton of things that Windows hides behind the scenes that Linux expects you to "just" understand. And that just makes it harder to understand where Linux and Windows are actually different too. File permissions is one of those things where Linux and Windows differ a lot.

main olive
#

@boreal kestrel just wanted to let you know that i did figure everything out, big thanks man

boreal kestrel
#

yw

red raven
#

file permission is kinda easy tho for unix too

#

sudo = admin

#

ls -l for full permissions, just gotta google what each letter means if you arent sure

#

i think its easier then trying to figure out in windows where its write only/read only ect ect

cedar coyote
#

hey there guys, out of curiosity does any one know bash? i could use some help with a script i'm writing. probably pretty simple, i'm just a dumb dumb.

formal schooner
#

just ask your question

#

what are you trying to do, what do you have right now, and what's not right about it

cedar coyote
#

I'm using bash to delete files in AppData, essentially I want to clear the cache in skype/Lync.
the code i have so far is

@echo off
echo Clearing Lync cache...
If %errorlevel%==1 goto Error
if "%LOCALAPPDATA%"=="" Set LOCALAPPDATA=%USERPROFILE%\Local Settings\Application Data
dir "%UserProfile%\AppData\Local\Microsoft\Office\16.0\Lync\sip_*" /b > list.txt
FOR /F "tokens=1" %%i in (list.txt) do del 

I'm adapting this from an earlier project from someone else. i just can't figure out how to make it then delete the names it outputs into list.txt I tried simpler stuff but the folders never get deleted

warped nimbus
#

This is not bash, it's batch

cedar coyote
#

lol that explains the reason why my commands weren't working, sorry about that.

main olive
#

@warped nimbus hi again, pretty silly question, but what is considered open source? Is discord app that is installed on my machine with all the files considered partially open source?

#

since i sure can't see the backend of API web servers its constantly interacting with, but can i not see the base source code of the app with all requests excluded?

warped nimbus
#

Open source is usually defined by the license under which the program was released

#

Being able to access the code doesn't make it open source by itself

formal schooner
#

the open source initiative defines what constiutes an "open source" license

#

otherwise it's "source available"

main olive
#

i see

#

but can i inspect the code of discord app

#

its based on chromium isnt it?

#

so i would assume i can?

oak shell
#

technically you can attempt to reverse-engineer everything

#

but ToS etc usually don't allow that

#

and it has nothing to do with "open source", rather the opposite

south star
#

they make efforts to prevent you from accessing the code, and they don't allow you to look at it, that's not open source at all

#

even if you had the full source on your drive, and nothing but the license prevented you from reading and copying it, it would still not be open source, because of the license

main olive
#

i see

warped nimbus
#

@robust cave I couldn't wrap my head around why opacity from compton wasn't working properly (it still appears really transparent at high values like 99%) for a few hours and turns out it may be this bug https://github.com/jwilm/alacritty/issues/2254

#

So that's the first issue I've encountered with it

#

At least it's already fixed but just not released yet

#

Maybe it's not even related I dunno 😩

robust cave
#

it’s probably that issue, hopefully the new release comes soon

#

the releases seem to be bi-monthly so the fix may be soon^tm

white solar
#

let the battery drain

#

or force shutdown

south star
#

what phone?

#

my lg g4 died that way

#

it was a common issue with them apparently

#

rip

grave jolt
#

can you get to the boot menu?

#

there usually is some button combo yo ucan mash on powerup to try to get there

#

and then you can factory reset

south star
#

volume up or down + power yeah

main olive
#

hi, how can i run one python script in a tmux session on raspberry pi (in console only mode)

#

I've tried making a .sh script and booting that on startup but that bricks it and just makes it infinitely break stuff

#

the script in question is called "main.py" on /home/pi

grave jolt
#

generally you want to create a daemon for important services like that. on modern linux distros you would do that with systemd

main olive
#

i'll try and mess around with that

safe flume
#

Trying to make install python 3.7.2 on fresh ubuntu 18.04 on rpi3. Getting errors related to gcov being undefined. Installed gcov is 7.4.0... why cant python make find gcov?

main olive
#

Hi

#

I have a unix script like this:

#

My server is like this:

#
/home/dom:
    -domalert:
        -venv
        - domalertv3
            -app.py
            -template
                -index.html
            -static
                -main.js
                -style.css
            -requirements.txt
#

and it says it cant access /etc/nginx/sites-enabled/domalertv3

warped nimbus
#

try running your script as sudo

main olive
#

ok

main olive
#
sudo apt install -y supervisor
echo "install supervisor"
sudo touch /etc/supervisor/conf.d/domalertv3.conf
echo "[program:domalertv3]
directory=/home/dom/domalert
command=/home/dom/domalert/venv/bin/gunicorn -w 5 app:app
user=dom
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stderr_logfile=/var/log/domalertv3/domalert.err.log
stdout_logfile=/var/log/domalertv3/domalert.out.log" >> /etc/supervisor/conf.d/domalertv3.conf```
#

so

#

i got nginx working

#

and everything else

#

but supervisor log says

torn snow
#

I'd argue in this case you should have the relevant files controlled by the dom user instead of just making the service run as root...

main olive
#

"no module named app"

#

wait i thought i did that this version

torn snow
#

Oh right you did

main olive
#

im logged in as the dom user and everything

torn snow
#

Good choice blobrofl

main olive
#

oh ok good

#

whew

#

yeah supervisor didnt like me using root

torn snow
#

Yeah it's easy to think sudo solves everything but it can cause more trouble than it fixes...

#

I'm guessing you double checked that the dom module is accessible from the given directory?

main olive
#

yup

torn snow
#

Shouldn't the directory= line be /home/dom/domalert/domalertv3?

#

Since that's where your app.py is

main olive
#

oh shoot

#

lol thanks

#

i'll try that in the morning

torn snow
#

Haha yeah stuff like that can be the worst

urban seal
#

Anyone using Supervisor here? (for running python script as services on linux)

finite moat
#

I've been using it a long time ago.

#

Not for python though.

main olive
#

im using supervisor but im a linux noob

livid nebula
#

Hey I have a question that might not belong here but im going to ask it. If i wanted to install linux on an ssd that had the installer on it how do i do that do i need another usb drive or can i install it to the same drive

oak shell
#

an external usb or dvd will be much simpler

#

it is possible to make an iso file on disk bootable (but difficult)

#

and you'd have to boot it to ram fully, then unmount it and hope you can still partition the disk, as I had issues with that before

grave jolt
#

yeah imo if you were going to do this, you should pre partition the drive and put a small partition at the end with the iso on it
then install grub on the drive ahead of time and add an entry for the iso
but a usb drive or something is WAY easier and you dont have to delete then resize partitions

#

if you have another os already on the system you could boot up a virtual machine and give it the ssd as a drive

marble bluff
#

is a daemon something that just listens at a port and does actions? can it return information?

outer reef
#

@marble bluff A daemon is any program that stays active in the background

#

Programs that will run in the background without requiring the user to interact with it are considered daemons

#

And yeah, it can return info or listen to ports, do stuff, etc.

#

It's just like any other program except you typically don't interact with it directly

marble bluff
#

can it return data? like if i made a daemon

outer reef
#

Like return it where

marble bluff
#

and asked "what's the result of blahblahblah"

#

idk

#

how would it return something

#

a pipe?

outer reef
#

Pipe, socket, writing to file, whatever you need it to do

#

Same as any other program

marble bluff
#

okay

#

so i can just have it listening at a port and then return information to another script via pipe

outer reef
#

Should be able to yeah

torn snow
#

@marble bluff if you want some more information, check out systemd for running the daemon and D-Bus or grpc for talking to it

marble bluff
#

👌

runic shard
#

why cant i install mongo

#

;v

main olive
#

try to install it from the cmdline, see what it says

#

sudo dpkg -i /tmp/mozilla_style0/mongodb*

#

@runic shard

runic shard
#

okey

#

but i cant now cuz im on other system

#

give me like 2 hours

main olive
#

aight

runic shard
#
style@style:~$ sudo dpkg -i /home/style/Downloads/mongodb-org-server_4.0.12_amd64.deb Selecting previously unselected package mongodb-org-server.
(Reading database ... 183574 files and directories currently installed.)
Preparing to unpack .../mongodb-org-server_4.0.12_amd64.deb ...
Unpacking mongodb-org-server (4.0.12) ...
dpkg: dependency problems prevent configuration of mongodb-org-server:
 mongodb-org-server depends on libcurl3 (>= 7.16.2); however:
  Package libcurl3 is not installed.

dpkg: error processing package mongodb-org-server (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Errors were encountered while processing:
 mongodb-org-server
#

;v

#

@main olive sorry for ping ;v

main olive
#

sudo apt install libcurl3?

runic shard
#

oo i think worked

#

thank you so much

main olive
#

np dude

main olive
#

when i tried to run python3 -m pip install -U discord.py[voice] on my centos VPS (yes it has python 3.7.3 installed on it) and i get this: -bash: python3: command not found

main olive
#

@warped nimbus do you know how i could get discord.py on my centOS VPS that has python 3.7.3 on it?

warped nimbus
#

Sorry but why am I in particular being pinged?

main olive
#

not sure why lol

warped nimbus
#

try using python3.7

#

try whereis python

#

maybe something is missing from your PATH

main olive
#

well, i managed to get it working

#

then after starting my bot up via putty, when i close out of putty my bot just stops working

warped nimbus
#

You'd need to create a service for it

#

You can do it with systemd

#

Look up tutorials on that

#

I bet DigitalOcean has one for it

#

They usually have good linux tutorials

main olive
#

i use PebbleHost VPSes

warped nimbus
#

Yeah I know you don't use DigitalOcean but their tutorials mostly apply to any linux system (sometimes they have some specific DO stuff but you can just skip it)

main olive
#

oh ok

warped nimbus
#

You can also look elsewhere of course

#

It was just a suggestion

main olive
#

ok

#

@main olive

then after starting my bot up via putty, when i close out of putty my bot just stops working

#

one way of doing it is services, like Mark said

#

but you can also run your bot in a screen session, that way you can detach and reattach to the console (if you need that)

#

oh ok

#

i installed screen

#

okay, now just run screen python [whatever bot]

#

done

#

in the new session, you can detach from it by doing CTRL-A-D

#

and reattach with screen -r

#

works? @main olive

#

yea

#

awesome

#

closing putty counts as "detaching" so it won't close the bot

#

then how do you reattach to that screen after you've exited PuTTY

#

next time you ssh in, you can just resume the session

#

again, with screen -r

#

then what if you have two screens for two bots?

#

you get something like this

#

so, how do you make more than one screen?

#

every time I detach, I'm just doing ctrl-a-d

#

oh ok

#

you can also just create them detached from the get go with the -d flag

#

well, the screen i end up making for one bot is screen: 0 and when i attempt to make another, it goes to screen: 0

#

wat

#

i've detached from 32XX in my VPS, so how do i create another screen for my 2nd bot?

#

just run screen on your second bot?

#

the 32XX whatever is the process ID

#

it's unique per spawned process

#

you can also name a session when starting it with -S name

#

so, like screen -d -S bot1 python3 [whatever the fuck]

#

names it bot1, and starts it already detached

#

oh ok

#

screen -S bot1 python3 <ect> will work the same but won't start as detached?

#

yep

#

whenever you have a question, just try it out bro

#

ok

main olive
#

got it working man?

robust cave
#

@main olive I have been contemplating using a terminal multiplexer over creating new terminal instances, what does screen offer over tmux, or vice versa?

main olive
#

if you're picking up a new tool, use tmux

#

the only reason i don't use tmux is because i'm stubborn and too used to screen

robust cave
#

thanks for the input

main olive
#

@robust cave additionally, I use screen very often anyways to connect to serial devices, so why learn something new?

rancid cliff
#

@main olive Just get a different distro that supports latest python then

main olive
#

They only have debian

#

@rancid cliff

rancid cliff
#

you're out of luck then if they dont have debian xenial

#

try somewhere else where they offer actual decent systems

main olive
#

do you think python3.6 supports debian 10?

#

@rancid cliff

rancid cliff
#

Dunno

formal schooner
#

@main olive yes

#

i recommend using pyenv to manage python on debian

#

let the system python just be the system python. basically ignore it

#

pyenv install 3.7.3 or whatever version you want, and use that for any dev work

#

then your dev version of python isn't tied to whatever the system happens to need

runic shard
#

idk if its correct channel

#

but i have problem with launching mongodb

runic shard
#

pls ping me if you have solution

tender anvil
#

Hey I've been trying to upgrade my system (I'm under arch) but jsut before it finishes I get this error: ... python-attrs: /usr/lib/python3.7/site-packages/attr/filters.pyi exists in filesystem python-attrs: /usr/lib/python3.7/site-packages/attr/py.typed exists in filesystem python-attrs: /usr/lib/python3.7/site-packages/attr/validators.py exists in filesystem python-attrs: /usr/lib/python3.7/site-packages/attr/validators.pyi exists in filesystem Errors occurred, no packages were upgraded.
From what I understand it's because there are already files which weren't thought to be there. However I don't understand why this is so. What mistake could I have done while doing some python that would cause this?

robust cave
#

how are you upgrading it?

tender anvil
#

pacman

#

Syu args

robust cave
#

have you tried running pacman -Syu again?

tender anvil
#

yes twice

robust cave
#

if you query one of the files for example pacman -Qo /usr/lib/python3.7/site-packages/attr/filters.pyi, is it owned by a package?

tender anvil
#

no

robust cave
#

have you installed anything into your Python installation with pip instead of pacman?

tender anvil
#

well yes lots of them

#

such as pandas, pygame and so on

robust cave
#

it's most likely that the files shown in the error was going to be provided by one of your packages through pacman, but pip already has them installed. therefore, it detected a file conflict and will not overwrite the files by default to prevent breaking something

tender anvil
#

so if all the modules are installed are just for scripts ran on occasion and manually it will not break my system?

#

all the modules I installed through pip are the ones I use for those projects

warped nimbus
#

maybe doing a user install will be safe

#

but you really should be using virtual environments

marble bluff
#

i'm trying to use nsjail, but i'm not sure how the chroot works

#

made adirectory /chroot/

#

in it i put bin with bash inside

#

and lib with the things that ldd said i needed

#

but when i run nsjail -Mo --chroot /chroot/ --user 99999 --group 99999 -- bash -i

#

it says that [E][1] void subproc::subprocNewProc(nsjconf_t*, int, int, int, int)():194 execve('bash') failed: No such file or directory

#

does anyone know how i'd goa bout fixing this

tender anvil
#

I will look at virtual environements then

#

still I'm going to need to fix this...

marble bluff
#

in this tutorial, is /alpine the name of the chroot directory? i'm a bit confused, as earlier they said a variable and now they have /alpine

#

i'm not actually sure, can i even have a chroot with alpine running on a different distribution?

warped nimbus
#

First error is probably because it expects an absolute path to the bash binary

#

Or maybe it's not on path

#

If this is running inside alpine then you should know alpine uses ash not bash

torn snow
#

@tender anvil to reiterate what others have said:

  • Never ever use sudo pip, it can break pretty much everything. This is what I suspect happened here. Your best bet is to uninstall everything you installed this way.
  • pip install --user is safer because it installs to your user directory, but you can still have issues with conflicts and the like.
  • The safest solution is to use virtualenvs for everything. This is what I personally do:
  • Use pipx for installing Python CLI programs, it'll automatically use venvs for them all.
  • If you're trying to set up a new project, check out Poetry, which is an absolutely amazing Python project manager that handles dependencies well and automatically virtualenv's everything.
  • If you want just a generic virtualenv, check out mkvirtualenv for a nicer interface.
main olive
#

i don't know who wrote this but it's got many errors

#

@marble bluff check out my script for setting up a chroot

#

all you need is the alpine rootfs extracted somewhere

torn snow
#

I've used the Alpine guide there before, it worked for me...

tender anvil
#

@torn snow @warped nimbus Thanks for the advices I'll try to learn of venv works before using other tools.

main olive
#

hello

hazy spruce
#

!ask

shy yokeBOT
#
ask

Asking good questions will yield a much higher chance of a quick response:

• Don't ask to ask your question, just go ahead and tell us your problem.
• Try to solve the problem on your own first, we're not going to write code for you.
• Show us the code you've tried and any errors or unexpected results it's giving
• Keep your patience while we're helping you.

You can find a much more detailed explanation on our website.

shadow patrol
#

can someone help terminate the terminal opened by appscript.app('Terminal').do_script('python pathname')

shadow patrol
#

how do I get the PID of a certain app using python?

edgy minnow
#

try pythonw? pid should be in ps

shadow patrol
#

@edgy minnow

#

i have a command which gives me the PID of the application but in terminal

#

is there anyway I could run that command in python to get the number?

#

like when i do 'ps -A | grep -m1 path | awk '{print $1}''

#

it prints it out in terminal

robust cave
#

check out the subprocess module

shadow patrol
#

@robust cave i have it dont work (or im dumb)

edgy minnow
#

theres psutil

shadow patrol
#

@edgy minnow could you help me with it?

#

ive legit been on this for 2hrs :/

edgy minnow
#
>>> psutil.pids()
[5034, 14581, 14734, 30719]
>>> p = psutil.Process(14734)
>>> p
psutil.Process(pid=14734, name='python', started='22:43:08')```
I think youd have to iterate over that list, if not use subprocesses to just run ps
shadow patrol
#

@edgy minnow i have the name of the file

#

/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr

#

is there like a getpid(/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr)

#

or kill (/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr)

edgy minnow
#

does ps show enough in name? or does it just say python

shadow patrol
#

wait Im confused @edgy minnow

#

whats ps?

edgy minnow
#

in terminal can you type ps

shadow patrol
#

okay

#

PID TTY TIME CMD
30158 ttys000 0:00.03 -bash
30192 ttys000 0:41.53 /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr
30194 ttys001 0:00.01 -bash
30200 ttys001 0:50.80 /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr
30205 ttys002 0:00.04 -bash

edgy minnow
#

anyway in python with psutil
iterate the pids & one of the p.exe()'s and/or p.name() should match that

shadow patrol
#

@edgy minnow so if I do

#

import psutils

#

name = p.exe()

#

ill get the name?

#

pid*

edgy minnow
#

with a for loop

for i in psutil.pids():
    p = psutil.Process(i)
    print(p.name())```
shadow patrol
#

@edgy minnow will this print all of the pids?

#

or only 30158 ttys000 0:00.03 -bash
30192 ttys000 0:41.53 /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr
30194 ttys001 0:00.01 -bash
30200 ttys001 0:50.80 /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr
30205 ttys002 0:00.04 -bash

#

or those ^

edgy minnow
#

can add an if check & use p.kill(). yea itll print the name of all of them

#

well should be just those 5 afaik

shadow patrol
#

so if i kill them its gg

main olive
#
sudo touch /etc/nginx/sites-enabled/domalert
echo "server {
    listen 80;
    server_name 45.7=;

    location /static {
        alias /home/dom/domalert/domALERTV5/static;
    }

    location / {
        proxy_pass http://127.0.0.1:5000;
    }

    location /socket.io {
        include proxy_params;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://127.0.0.1:5000/socket.io;
    }}" >> /etc/nginx/sites-enabled/domalert
cat /etc/nginx/sites-enabled/domalert``` any reason as to why this script echos the text to the file like this ```server {
    listen 80;
    server_name 457.57;

    location /static {
        alias /home/dom/domalert/domALERTV5/static;
    }

    location / {
        proxy_pass http://127.0.0.1:5000;
    }

    location /socket.io {
        include proxy_params;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade ;
        proxy_set_header Connection Upgrade;
        proxy_pass http://127.0.0.1:5000/socket.io;
    }}```?
#

ignore the server_name I redacted that

edgy minnow
#

need to escape the $

shadow patrol
#

@edgy minnow how do i install psutils

edgy minnow
#

thought it was stdlib & builtin? if not try pip

shadow patrol
#

I did

#

it said No matching distribution found for psutils

main olive
#

@edgy minnow what do you mean?

shadow patrol
#

name 'psutils' is not defined

edgy minnow
shadow patrol
#

oh i was doing pip psutils

#

hehehehe

#

thats awkward

main olive
#

need to escape the $

#

what do you mean?

#

How do I do that?

edgy minnow
#

\$

#

otherwise its assigns the variable

shadow patrol
#

ImportError: No module named piputil?

#

@edgy minnow its not working :/

#

i need to import piputil?

edgy minnow
#

pip install psutils

shadow patrol
#

done

main olive
#

oh ok

shadow patrol
#

wait @edgy minnow

#

ERROR: No matching distribution found for psutils

#

but it worked for psutil

edgy minnow
#

oh my bad no s

shadow patrol
#

okay

#
import subprocess 
from subprocess import call
import appscript
import piputil

appscript.app('Terminal').do_script('python //Users//myname//Desktop//FacialRecognition.py') 

while True:
    for i in psutil.pids():
        p = psutil.Process(i)
        print(p.name())

#

is this correct?

edgy minnow
#

shouldn't need the while. & is there no way to have the FR.py close itself?

#

not familiar with appscript btw

shadow patrol
#

@edgy minnow ya but the for i in psutil.pids():
p = psutil.Process(i)
print(p.name())

#

will run too fast

#

it takes a second for facialregocnition

edgy minnow
#

yea that looks fine

shadow patrol
#

NameError: name 'psutil' is not defined

#

@edgy minnow ^ 😦

edgy minnow
#

tried pythonw?

you have piputil instead of psutil

main olive
#
    location /socket.io {
        include proxy_params;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade\$;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://127.0.0.1:5000/socket.io;
    }}" >> /etc/nginx/sites-enabled/domalert```
#

like that?

shadow patrol
#

what?

main olive
#

import piputil

edgy minnow
#

your import

\$http_upgrade

main olive
#

oh ok

shadow patrol
#

import subprocess
from subprocess import call
import appscript
import piputil$http_upgrade

appscript.app('Terminal').do_script('python //Users//myname//Desktop//FacialRecognition.py')

while True:
for i in psutil.pids():
p = psutil.Process(i)
print(p.name())

#

like that?

edgy minnow
#

no was answering their q too. change that import to psutil

shadow patrol
#

okay

#

@edgy minnow it prints

#

all the apps running

main olive
#

Hyper have you ever used nginx/flask/gunicorn with socketio?

edgy minnow
#

dont think so no

main olive
#

ahh damn ok

shadow patrol
#

@edgy minnow can i do

#

psutil.Process(path)?

#

or path.pid

edgy minnow
#

you can check against the name

if p.name() == '/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr':
    print(i)```
shadow patrol
#

But it’s name is just python

#

@edgy minnow it is still fine?

#

Like it prints just python

edgy minnow
#

what does .exe() print?

shadow patrol
#

Idk I have to leave now because I have to leave now 😢

#

Not my choice

#

I’ll be back in 20-30mins

edgy minnow
#

well check exe, python wont work right as theres a specific one you want

shadow patrol
#

Yep

#

@edgy minnow thanks

edgy minnow
#

if I'm not on later... if theres just 2 python pids you can get the current scripts one with os.getpid() so ignoring that one the other would be from the other one

main olive
#

@edgy minnow just to confirm the script should look like this:

#
echo "server {


    location /socket.io {
        include proxy_params;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://127.0.0.1:5000/socket.io;
    }}" >> /etc/nginx/sites-enabled/domalert```
#

so the end result is this:```
echo "server {

location /socket.io {
    include proxy_params;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_pass http://127.0.0.1:5000/socket.io;
}}" >> /etc/nginx/sites-enabled/domalert```
#

because I tried the script like that (first embed) but it resulted in in like this:

#
server {

    location /socket.io {
        include proxy_params;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection Upgrade;
        proxy_pass http://127.0.0.1:5000/socket.io;
    }}```
edgy minnow
#

escape the "s too there & should be fine

shadow patrol
#

@edgy minnow you there?

edgy minnow
#

yea

shadow patrol
#

when i do

#

while True:
for i in psutil.pids():
p = psutil.Process(i)
print(p.exe())

#

it says

#

psutil.AccessDenied: psutil.AccessDenied (pid=0)

edgy minnow
#

something running as superuser perhaps?
maybe wrap a try/except or skip 0...

#
for i in psutil.pids():
    if i != 0:
        p = psutil.Process(i)
        print(p.exe())```
main olive
#

\$http_upgrade;\

#

like that @edgy minnow

shadow patrol
#

@edgy minnow it says the path

#

now how do i get the PID

#

raise ZombieProcess(proc.pid, proc._name, proc._ppid)
psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=31680)

#

but what is this?

edgy minnow
#

i will be the pid, so you can add the if there. no idea what that is.

are you getting 1 matching path?

shadow patrol
#

like I see the path

#

now how do I do like p.PID

edgy minnow
#

if p.exe() == path:
print(i)

#

or print p.pid

shadow patrol
#

for i in psutil.pids():
if i != 0:
if p.exe() == path:
print(p.pid)

#

this right?

#

@edgy minnow

edgy minnow
#

with path being the thing you want to match yea

#

and indent the print

#

after a : the next line moves in >

shadow patrol
#

ye

#

for i in psutil.pids():
NameError: name 'psutil' is not defined

#

@edgy minnow

#

nvm found it

#

if p.exe() == "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr":
NameError: name 'p' is not defined

#

got it again

shadow patrol
#

can any1 one help

#

im getting this error

#

File "/usr/local/lib/python2.7/site-packages/schedule/init.py", line 563, in run_pending
default_scheduler.run_pending()
File "/usr/local/lib/python2.7/site-packages/schedule/init.py", line 94, in run_pending
self._run_job(job)
File "/usr/local/lib/python2.7/site-packages/schedule/init.py", line 147, in _run_job
ret = job.run()
File "/usr/local/lib/python2.7/site-packages/schedule/init.py", line 466, in run
ret = self.job_func()
File "/Users/Gitansh/Desktop/Main.py", line 22, in stop
if psutil.Process(i).exe() == "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.fr":
File "/usr/local/lib/python2.7/site-packages/psutil/init.py", line 773, in exe
exe = self._proc.exe()
File "/usr/local/lib/python2.7/site-packages/psutil/_psosx.py", line 339, in wrapper
return fun(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/psutil/_psosx.py", line 420, in exe
return cext.proc_exe(self.pid)
File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/site-packages/psutil/_psosx.py", line 370, in catch_zombie
raise ZombieProcess(proc.pid, proc._name, proc._ppid)
psutil.ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=35038)

torn snow
#

You're trying to analyze the state of a zombie process

grave jolt
#

yeah something you did elsewhere in your program caused the process to become a zombie, which i think means the process is intended to be closed but has not done it yet and lost its parent process

shadow patrol
#

Ah okay

gritty stirrup
#

Does anyone know why i can't run this executable?

#
adam@vmi261078:/usr/local/bin$ sudo chown adam:adam sharpops
adam@vmi261078:/usr/local/bin$ chmod u+x sharpops
adam@vmi261078:/usr/local/bin$ sharpops
-bash: /usr/local/bin/sharpops: No such file or directory
adam@vmi261078:/usr/local/bin$ ls -l
total 24172
-rwxr-xr-x 1 root     root     16168192 Jul 26 22:25 docker-compose
-rwxrwxrwx 1 adam     adam      8574154 Aug 17 21:24 sharpops
drwxr-xr-x 3 sharpops sharpops     4096 Aug 17 21:24 sharpops-data
adam@vmi261078:/usr/local/bin$
sage solar
#

I have seen this exact issue three times an I cant remember the fix, I should write it down at some point.....

gritty stirrup
#

Lmao

#

Nix what is the problem roughly?

sage solar
#

I can never remember

#

It is horrible

#

oh

#

@gritty stirrup can you file it

gritty stirrup
#

wdym?

sage solar
#

file sharpops

gritty stirrup
#
adam@vmi261078:/usr/local/bin$ file sharpops
sharpops: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/
ld-, not stripped
sage solar
#

Hm, I remember the issue being a 32 bit thing once but this seems to be fine

gritty stirrup
#

fuck

sage solar
#

can you check it with lld as well?

gritty stirrup
#

I rebooted the server

#

2 seconds