#programming

1 messages · Page 19 of 1

surreal bronze
#

😆

floral wedge
#

I need a little help with qt5. Somehow it produces this error and doesnt open. Ive read sth about local variables not being set correctly but dont know what to do with that. Ive tried reinstalling qt5 but that didnt fix it. Any idea on how to get it working again?

surreal bronze
#

Okay

#

Have you searched on google this error?

floral wedge
#

yeah sure. Thats where I found out about the local Variables but that didnt really help me because I dont know what it is and what it has to do with qt5.

surreal bronze
#

What does the qt5ct supposed to do?

floral wedge
#

open this tool

surreal bronze
#

Ah the configuration

floral wedge
#

yeah

surreal bronze
#

What is your OS?

floral wedge
#

I want to use dolphin file manager on arch with gnome desktop

#

But dolphin is a KDE package and doesnt accept the system default theme of gnome, which is why I wanted to use qt5 to change that

surreal bronze
#

I see

#

In /etc/environment

#

What is the value of

QT_STYLE_OVERRIDE

floral wedge
#

dont have that

surreal bronze
#

Okay I'm reading from this

#

Any of these solutions working for you?

floral wedge
#

nope :/ but I also dont have the qt5ct.conf the guy is talking about. Maybe thats it.

surreal bronze
#

Maybe it is

#

If that doesn't run you could try with different qt versions and see if it's that

floral wedge
#

Good idea. Ill try that and come back here if it doesnt work, thanks!

#

I installed qt6ct and it works just fine :)

surreal bronze
#

Aye! 🙂

north heron
#

i had a dream that someone hacked my pc again Lmao

#

i'm going crazy

echo karma
#

hey bro

#

@north heron you got hacked?

north heron
#

ye

echo karma
#

explaid how it happen

#

maybe you have risky behavior

#

downloading apps

north heron
#

no, i used a common password

dusty ore
#

It would be great if someone can help me

#

I'm kinda new to coding

#

I'm like making a "bot thingy"

#

I'm using selenium to automate the process of: going into the url -> doing stuff

#

But the url requires a token id

#

like this lmao.com/?token=123

#

So I have a list of some token id (which I create a new account to get those)

#

put it in a json file

#

and put these 2 lines of code

#

nah wait i think im figuring it out

#

lol

echo karma
#

@dusty ore JohnLmao how much old are you

dusty ore
#

ah umm im 16

echo karma
#

mmm... use selenium or imacros

#

its aboslutly wasted time

#

use javascript

dusty ore
#

javascript huh

echo karma
#

yes ofcourse

dusty ore
#

like can it do

#

go to the website, press a button, etc..

echo karma
#

using a browser extension

dusty ore
#

im kinda stupid

echo karma
#

dev a browser extension

#

use a chrome extension or firefox extension to do so

dusty ore
#

hmm thats a nice suggestion, thanks

#

but i guess ill still stick to python as im studying it

#

its a good practice tho

echo karma
#

may be

#

an chrome extension is easy to do and its javsacript 100%

#

and you can upload script in chrome market

#

and use it anywhere

dusty ore
#

oh ye

#

but this is a temporary project

#

Like it will be very useful but it will be useless after a month

echo karma
#

so you can use imacros if its easy task to do

dusty ore
#

thanks, ill have a look about it

echo karma
#

this is asking for path to .json

#

json is key value file

#

{key:value}

#

i dont know what are you doing, if you show me more code may can help more

dusty ore
#

oh ye i forgot to tell you

#

I changed .json to .txt

#

and used open

#

its easier

echo karma
#

great

#

if you need help let me know

#

also i can do a chorme extenson fast for you

#

i have template ready to do so

dusty ore
#

Thanks but I think I'll do it on my own

#

studying ya know

#

hehe

echo karma
#

yes, its very easy jhon!

dusty ore
#

Ye

#

Thanks for your help

true pumice
#

@cursive orchid I know the issue with your JS script

#

(If you still need help that is)

vagrant zodiac
#

anyone who could help me out with the csv module in python?

onyx merlin
#

Just ask

vagrant zodiac
#

well i have a file open, witch im hashing the passwords in, that woorks well when printing to the terminal.
not so good when im trying to write them to a new file

surreal bronze
#

Can you provide the code

vagrant zodiac
#

yess sir

#

so the testpw has some passwords i want to hash to make a rainbowtable. and the rainbow.csv is where i want to store them

brazen eagle
#

your row seems to be out of scope

#

unless I'm missing something

#

salt too

#

why are you salting a rainbow table though?

vagrant zodiac
#

no reason, used that for another script so just pasted over until i get this to woork

#

how is it out of scope? for row in "file", what else could i do?

brazen eagle
#

not what I'm seeing

#
with open("testpw.csv") as passwords:
    for row in passwords:
        salt_sha512 = crypt.crypt(row, crypt.mksalt(crypt.METHOD_SHA512))


with open('rainbow.csv', 'w', newline='') as rainbow:
    fieldnames = ['password', 'hash']
    writer = csv.DictWriter(rainbow, fieldnames=fieldnames)

    writer.writeheader()
    writer.writerow(f'password: {row}, hash: {salt_sha512}')
#

this is what I see

vagrant zodiac
#

ooh so you would do "for row in testow.csv"?

brazen eagle
#

just saying that in the rainbow block, row no longer exists

vagrant zodiac
#

makes sence its outside the block, but ive tryed with it inside to, im doing somthing wierd..

brazen eagle
#

might want to transfer to an intermediate dictionary

vagrant zodiac
#

makes sence, ill try:)

magic falcon
#

you are trying to implicitly scope row to global, when it is a transient object

sharp coral
#

Have a good self-study problem I'm stuck on. Need to generate list of passwords. I'm given 3 separate lists. 4th list is user-generated and varying length depending on cmdline arg. The main problem is this, each password must consist of only ONE element from each list - meaning I will need to generate every possible permutation within these constraints. Itertools is doing the heavy work here but its still confusing as heck.
my code so far and problem prompt are at https://github.com/Droogy/programming-training/blob/main/Problem1/

would def appreciate any guidance!

vagrant zodiac
#

did not get it to woork.. ill try again tomorow, thnx for the help anyway

#

well thnx @sharp coral you had the answer to my question in your code XD.

sharp coral
#

haha glad I could help somehow!

onyx merlin
#

I'd just do four nested loops...

sharp coral
#

thank you I'll give that a try

true pumice
#

I think I have a working version of your problem Droogy so ping me if you need a little nudge and I'll assist :)

sharp coral
#

will do! appreciate you taking a look

brazen eagle
#

unless order needs to be taken into account as well

onyx merlin
#

Depends what you mean by order

brazen eagle
#

lists can be in any order

onyx merlin
#

Because it will be in order, in the order of the list

brazen eagle
#

ie 1, 2, 3, 4 or 4, 3, 2, 1

#

or 2, 4, 3, 1 (for example)

#

so there'll be more than 4 loops nested

sharp coral
#

thats correct hydra, i need all permutations like that so

1234
1243
...
4321
#

thats my expected output

brazen eagle
#

yeah so there's 4! permutations, assuming I'm not forgetting my combinatorics

sharp coral
#

gah Im right back where I started with the 4 nested loops vs. itertools

brazen eagle
#

this is a fun question, I might steal it as a kata

magic falcon
#

that was what i got, hydra n * m * o * p * 24 unique orderings

brazen eagle
#

so yeah a good chunk

sharp coral
#

it is a fun one, a friends mom forwarded me this, shes an IT exec and said one of her engineers made this question for new hires

mellow moth
#

Guys, I'm taking a cybersecurity course from ine.com, and in the second module they ask for do a simple exploitation writing a program with c++, and is recommended to use a dirent c++ library and winsock, because the goal is steal the directory info from the lab.

So, my question is in the fact that, I'm doing it, through a lot of read in internet and I have some knowledge in programming because I'm a front-end developer, but the thing is that I don't feel satisfied just being able to do and many things seem so obscure in C++, but when i tried to understand some pieces they grow into bigger ones, and it seems very hard to get all concepts at once.

I would like to know if in your study you were studying every little thing, like networks, tools, programming simultaneously or if you specialized first, like low level programming and then to the next step.

Sorry for my english.

sharp coral
#

if its for eJPT, I wrote that module in Python, try and adapt new things to your existing skillset and throw away things that don't fit

#

theres a lot of foundational topics you should understand to break into IT in general, and a further subset of those foundations is necessary for infosec

#

but don't try to do all the things at once, networking is a great place to start learning imo

mellow moth
#

I think i understood, about networking i'm studying a lot, but my concern was to not have a deep knowledge in low level programming and this will end up impacting me in the following studies, but your tip, about focus in my existing skillset will be very useful, thanks.

sharp coral
#

no, low-level programming is good to have a general understanding of, but is generally a pretty niche skillset in infosec usually reserved for malware analysts/reverse-engineers

mellow moth
#

Oh, right.
Thank you again!

viral jackal
#

“Automate the boring stuff with Python” is free for a limited time!

One of the highest rated Python courses is free for a limited time.

If it’s not automatically applied, use code FEB2021FREE

https://www.udemy.com/course/automate/

spare river
#

It's actually free online forever via the author's website.

wispy tusk
wispy tusk
true pumice
#

You cannot ask how to do something with a very vague request and expect me to know what you want.

wispy tusk
true pumice
#

And I linked you plenty of resources, if you aren't going to read the ones I linked then don't complain.

wispy tusk
#

I'm not complaining. I just explained myself. I am reading all the resources you provided one by one. I just replied to the first one among them.

#

I read all of them...same thing. Not what I'm looking for

true pumice
#

You asked how to remove a commit from the history

wispy tusk
#

I asked "How to remove history of a specific commit”

lilac holly
#

32

wispy tusk
#

I already removed a commit, now i want to remove the information Stored about it in the history.

#

Googling the problem results into the same solutions which you provided. That's the very reason I asked here and posted it on stack overflow.

slender nymph
#

Heya! So I was hoping someone could give me some ideas of how I can get this to properly spit out into clipboard. I started practicing python a solid hour ago after not having touched it since middle school.

Phone_Number = input("Enter five digits for PhoneNumber: ")
First_Name = input("Enter a first name: ")
Last_Name = input("Enter a last name: ")
DOB = input("Enter a date of birth. Year-Day-Month Ex;1996-07-13: ")
Result = "/me hands over their ID\n^*^4 [ID]^r: TID #: ^2"+Player_ID+"^r SSN #: ^2 "+Phone_Number+" ^r | First: ^2"+First_Name+" ^0/ Last: ^2 "+Last_Name+" ^0| DOB: ^2 "+DOB+" ^0|_"

import pyperclip
myStr = Result
pyperclip.copy{myStr}```
#

It's a program made for a GTA RP server I used to play on. It's what I like to use instead of hello world.

true pumice
#

So what is your end goal exactly?

#

/me hands over their ID ^*^4 [ID]^r: TID #: ^2123^r SSN #: ^2 12345 ^r | First: ^2abc ^0/ Last: ^2 def ^0| DOB: ^2 1996-07-13 ^0|_

Seems to work fine

#

The only thing I changed was:

import pyperclip

pyperclip.copy(Result)
slender nymph
#

Honestly everything so far seems to work out. Everything from Player_ID to DOB should be user input. I am just not understanding why I can't get it to clipboa-...

true pumice
#

Mhhm, all you had was a syntax error.

#

Usually when calling functions you use (arguement), as opposed to {arguement}

slender nymph
#

Might need to restart some stuff. As I'm still running into an error.

true pumice
#

Here's the whole program with changes:

#
Player_ID = input("Enter Server ID: ")
Phone_Number = input("Enter five digits for PhoneNumber: ")
First_Name = input("Enter a first name: ")
Last_Name = input("Enter a last name: ")
DOB = input("Enter a date of birth. Year-Day-Month Ex;1996-07-13: ")
Result = "/me hands over their ID\n^*^4 [ID]^r: TID #: ^2"+Player_ID+"^r SSN #: ^2 "+Phone_Number+" ^r | First: ^2"+First_Name+" ^0/ Last: ^2 "+Last_Name+" ^0| DOB: ^2 "+DOB+" ^0|_"

import pyperclip

pyperclip.copy(Result)
#

As you can see I only changed the bottom, I may add defining the variable myStr to store the value of Result seems entirely pointless in this program

#

What error is occurring for you?

slender nymph
#

I did add a pointless string... Seems PyCharm refuses to believe I have Pyperclip setup.

true pumice
#

Ah, I do not use PyCharm. I am using the default Python shell.

slender nymph
#

I'll work this out, Though I appreciate your help and thank you for noting the useless string. Much I still need to get a grasp on.

true pumice
#

Mhm, no problem

true pumice
#

Hm?

vernal vigil
#

Nothing

true pumice
#

Ok...

slender nymph
#

I think I found what I did wrong, now I just need to figure out how to resolve it... Say just to make sure I was the big dum... Would me throwing in the pip for pyperclip while it's still in a temp\Rar folder be the reason I am now getting a fileNotFound error?

true pumice
#

Does it specify which file is not found?

slender nymph
#

src/pyperclip/__ init __.py

true pumice
#

Not sure how PyCharm works, if it has a console/ package manager try installing pyperclip through there, if not manually copy and paste the pyperclip files to the directory requested. (Be sure not to delete the original files just in-case)

surreal bronze
#

the only good thing about pycharm is its debugging

slender nymph
#

We gottem boys! I'll be honest. I just close the entire enviroment out and started anew with the same code. Works fine now after dropping pyperclip back in.

true pumice
#

👍

magic falcon
brazen eagle
#

the BFG might work

#

but because commit history is a graph, removing one single commit will completely break the graph

wispy tusk
brazen eagle
#

the file is probably still there then

#

git doesn't work that way though, it doesn't know about files

wispy tusk
brazen eagle
#

ok then what's the problem?

wispy tusk
brazen eagle
#

interactive rebase rewrites the history

#

you'll probably need to force push the changes

wispy tusk
wispy tusk
brazen eagle
#

so what's the problem?

#

you rewrote the history, the original commit no longer exists

#

we're good, no?

wispy tusk
#

'ab472' This is the hash of the commit I removed. It doesn't show up in git log anymore. But when I use git show ab472, it shows all the detals of that commit

brazen eagle
#

have you tried to gc?

#

might be some housekeeping options on github as well

wispy tusk
#

No, I'm not sure what It does.

wispy tusk
#

Still the commit is being shown while using git show

brazen eagle
wispy tusk
brazen eagle
#

normally what happens in git stays in git. Is there a reason why this commit needs to disappear?

wispy tusk
brazen eagle
#

is that a problem?

#

or did you forget to protect master?

wispy tusk
# brazen eagle is that a problem?

Yes that is the reason I am trying to remove that specific commit and its history. When I started the project I had least idea about git and github and I added lots of people as contributors rather than following the gitflow, which created a big mess.

brazen eagle
#

seems you may have to nuke and pave, though there appears to be a -mirror option

#

git is made to keep history as robustly as possible

wispy tusk
#

I successfully removed the commit and now The readme file which that other user commited on is now showing only 1 contributor i.e. me, but in the remote repo the name of the contributor is still being shown even though presently there is not commits in the repo by that user.

brazen eagle
#

git push --mirror --force ?

wispy tusk
brazen eagle
#

yeah

wispy tusk
#

Anyways thanks for your help @brazen eagle 🙂

brazen eagle
#

nuke and pave then, probably, sorry

cursive orchid
#

@true pumice aww thank you

#

but i fixed it now

true pumice
#

What did you do to fix?

cursive orchid
#

it's because i was mutating the array directly without making a copy of it first

#

it was something like

oldCells = [...oldCells];

if () {}
else {}

return [...oldCells];
#

had to add that top line

#

i don't fully understand why that works, but i was told i can't mutate the array and then return the copied value or smth

true pumice
#

The reason for the if and else statement both running was simply because it was checking a value which was null

cursive orchid
#

i was checking if it wasn't null though in the if

true pumice
#

Mhhm, I asked my brother and he told me how to change the program to make it work but I can't remember 😄

brazen eagle
#

ah arrays are by ref yeah

stone kayak
#

How would you test a web-crawler against live websites / IPs?

I'm thinking:

  • pytest-mock the API calls locally so local test times are decreased
  • test against live APIs in CI as part of integration testing, and CI can run much longer than pytest can on a small devs laptop etc
  • Test against external websites (?) such as those not controlled by the organisation to see if it can hold up (but mark those tests as can-fail, so if they do fail because of an external website going down CI isn't down)

That last point is kinda ??? for me as I'm not sure on best practices 🙂

#

This is 100% a homework question but I just wanted to triple check with people who are in industry, as well uni didn't teach me these things hahahah

brazen eagle
#

maybe use an existing spider such as that used on ZAP and compare to your results?

#

or manually trawl through the site to see what you find?

stone kayak
brazen eagle
#

I'd have a known good and compare against that

#

also go annoy the site devs

#

😄

#

but external sites are always iffy to test against,

#

integration tests need to be on live, but controllable data

stone kayak
#

Is it too much if I say "deploy a website with cyclic links, broken links, etc on an EC2 instance in a different region"?

brazen eagle
#

ooh that'll break things nicely

#

why not locally in a docker container?

stone kayak
#

cause we can control that I think, we can deploy it with CI whenever we want and we don't rely on someone elses site

stone kayak
brazen eagle
#

to the crawler it's all the same

#

ah ok

stone kayak
#

hey i think im actually pretty good at this hahahaha

brazen eagle
#

sure, different regions are always good

stone kayak
#

it would cost money, but if its essential for the business it's the best we can do I think

brazen eagle
#

or google

#

or other big sites that don't change much

violet cipher
#

just wrote this for you run it in CLI maybe it gives you some ideas

magic falcon
lilac holly
#

does anyone know pyautogui here

#

or how to use it

#

if so can u tell me if pyautogui have some kind of key detecter

#

like

#

if it can see if ur holding down right clicke

vague loom
#

Have you read the docs?

onyx merlin
#

What are you trying to do with it? @lilac holly

surreal bronze
#

If you just search on Google it's the first result

lilac holly
#

oh sorry

lilac holly
#

if its even possible in python

onyx merlin
#

?

lilac holly
#

yk keystroke

#

s

onyx merlin
#

Stupid keystroke thing?

surreal bronze
#

You mean a keylogger?

lilac holly
#

whats that

onyx merlin
#

What are you trying to accomplish? Describe it.

lilac holly
#

ok have u heard of minecraft keystrokes

#

if u press w it highlights w

#

press a it highlights a

#

well i was bored so i was like hey why not make a keystroke but like just a fun program

surreal bronze
#

You want a GUI that highlights the key you press?

lilac holly
#

ya

#

if its even possible, but it should be

true pumice
#

You can but Python probably is not the best for that.

surreal bronze
#

Well it is possible quite easily

lilac holly
#

yeah

surreal bronze
#

Just use the keyboard module

lilac holly
#

wait what

#

theres a keyboard module

#

???????

#

stdlib?

surreal bronze
#

It has a function to check what key is pressed

lilac holly
#

wow thats useful

#

can it check mouse clicks

surreal bronze
#

I don't think mouse clicks

lilac holly
#

if it cant, ill just use pyautogui to check

#

well tysm

#

this module will defo help me alot

#

im also trying to practice pyqt

surreal bronze
#

👍

lilac holly
#

ok bye

surreal bronze
#

Bye

trim flax
#

hello

surreal bronze
#

hi

pulsar sierra
#

Anyone good enough to help me with a issue with JS ? Don't hesitate do DM me, I could send it here, but I don't know if I'm allowed lol

true pumice
#

If you're not allowed to send it here, there is a chance you're not meant to be discussing it at all.

onyx merlin
#

Why don't you think you're allowed? @pulsar sierra

pulsar sierra
true pumice
#

If it's programming, it is allowed. Ask away.

pulsar sierra
#

Alright

#

So I have this code

function getApiResult(url, data) {
    fetch(url).then(
        response => {
            return response.json();
        }
    ).then(result => {
        for (var i in result.results) {
            data.push(result.results[i])
        }

        if (result.next == null) {
            return;
        } else {
            getApiResult(result.next, data);
        }
    })
}

let data = [];
getApiResult("http://localhost:8000/api/v1/titles/?sort_by=imdb_score&imdb_score_min=9", data);
console.log(data);
console.log(data[0]);

But when I execute it, I get this in my console :
[]
undefined
While testing, I understand that when the console.log(data) at the end is not fully loaded (waiting for the fetch to finish) ...
I don't get how can I exploit data, only when it's finished :/

PS : I already tried to put it in an async function and make await GetApiResult("...", data) instead of what I have right now

true pumice
#

(As long as it follows the rules of the server and laws)

pulsar sierra
#

Of course :)

brazen eagle
#

ah promises

pulsar sierra
#

D: yeah

brazen eagle
#

you won't get your data back immediately

#

but the code will continue as if it did

#

await should work though

#

though I don't know how the recursion will work with promises

violet cipher
pulsar sierra
#

Actually, I fixed it since

#

But thanks though

violet cipher
#

No prob, have a good one

haughty trench
#

Are you a polyglot? How many #programminglanguages are you good at? Take the new #developersurvey and share your #coding skills for a chance to win new gear! #Javascript #java #Python #Csharp #PHP #Kotlin #Swift #Lua

surreal bronze
#

whats that?

#

@haughty trench

tribal smelt
#
<div class="modal fade" id="login" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4>Login</h4>
        </div>
        <div class="modal-body">
            <form id="myForm" method="post" action="authenticate.php">
                <div class="input-line">
                    <input id="email" type="email" name="email" required
                        placeholder="E-mail" class="input-name">
                    <input id="password" type="password" name="password"
                        required placeholder="Password" class="input-name">
                    <button type="button" id="submit" value="submit"
                        form="myForm">Submit</button>
                </form>
            </div>
        </div>
    </div>
</div>

<form action="authenticate.php" method="post" target="_blank">
    <label for="email">Email:</label>
    <input type="email" id="email" name="email"><br><br>
    <label for="password">Password</label>
    <input type="text" id="password" name="password"><br><br>
    <button type="submit" value="Submit">Submit</button>
</form>

The one outside the modal is submitting, the one inside the modal is not.. How come?

solar hull
#

I'd like to say it's because your indentation isn't consistent, but that's not the reason kekw

tribal smelt
#

I will apologize for that in advanced, I know it's brutal but this is quick and dirty.

brazen eagle
#

you can add highlighting to the code with \``` html

#

minus one ` I really have to look up the escapes

onyx merlin
#

Backslash as usual

#

```html
CodeGoesHere```

brazen eagle
#

bah

#

what james wrote

tribal smelt
#

I will do that in a moment.

brazen eagle
#
<button type="button" id ="submit" value="submit" form="myForm" formmethod="post">Submit</button>
onyx merlin
brazen eagle
#

that's different

#

yeah but I tried to enclose in a ` ` block

#

which makes the parser derp out

tribal smelt
#

there.

#

it's all nicely indented and pretty colours now

brazen eagle
#
<form id="myForm" method="post" action="authenticate.php">
                <div class="input-line">
                    <input id="email" type="email" name="email" required
                        placeholder="E-mail" class="input-name">
                    <input id="password" type="password" name="password"
                        required placeholder="Password" class="input-name">
                    <button type="button" id="submit" value="submit"
                        form="myForm">Submit</button>
                </form>
            </div>

the divs are off

#

at least closing tags

tribal smelt
#

oops, i changed that previously.

brazen eagle
#

dunno if the form attribute is strictly necessary on the submit button

tribal smelt
#

I ain't sleeping until I get this whole thing working so it's gonna be a lateeeeeee night for me

#

nah, that was a test thing as well

brazen eagle
#

shouldn't the form have a name attribute for that to work?

tribal smelt
#

possibly, I'll give it one and test

#

negative

#

if anyone comes up with a possible solution, can they @ me please.

brazen eagle
#

copy pasting the form outside the model inside seems to work

tribal smelt
#

@brazen eagle What do you mean? its 1:24AM here, I'm gonna be a little slow.

brazen eagle
#
<div class="modal fade" id="login" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4>Login</h4>
        </div>
        <div class="modal-body">
            <form action="authenticate.php" method="post">
              <div class="input-line">
                <input type="email" id="email" placeholder="E-Mail" name="email">
                <input type="password" id="password" placeholder="Password" name="password">
                <button type="submit" value="Submit">Submit</button>
              </div>
          </form>
        </div>
    </div>
</div>
tribal smelt
#

ohh

brazen eagle
#

forms are wierd sometimes

tribal smelt
#

Can I dm you?

#

heyooo

#

@brazen eagle ❤️ ❤️ ❤️ ❤️

brazen eagle
#

sec, work

tribal smelt
#

no problem

brazen eagle
#

ok what's up?

fathom idol
#

Has anyone ever gotten WPA2 handshakes to be properly captured in Scapy?

remote echo
hazy breach
#

I've written a function in python, which loops through the wiki streams API, giving me events as they happen.
I'm processing the events and collecting data.
I want to print the processed data at one minute intervals. What would be a simple solution to maintain a timer parallelly?
I googled and started reading up on asyncio but got a little lost. xD

modern laurel
#

you can use time.sleep(seconds you want)

hazy breach
#

I don't need to pause the code

#

Let's say I get one event every 11 seconds in the loop I'm processing.
In 55 seconds, I'll have five events...
In 66 seconds, I'll have six events....

When 60 seconds of computation has been done, I need to print the results and continue processing for the next minute

modern laurel
#

i understand that you want to run event in background after that print the data

#

am i right? btw sorry my english is little bad

hazy breach
modern laurel
#

ok

magic falcon
#

effectively, your consumer is looking at a queue being fed by the producer - once a minute, check the queue. if nothing is there, go back to sleep.

hazy breach
#

Thanks

magic falcon
#

if you dont' understand how python multiprocessing libs work, feel free to follow up

hazy breach
#

I don't, not yet at least. I've just started reading up on them.
Any good starting points which aren't hugely in depth?

magic falcon
#

the python docs are pretty good - caveat there is i already had an understanding of POSIX threads, so the python stuff is super simple in comparison

#
Toptal Engineering Blog

Concurrency allows programs to deal with a lot of tasks at once. But writing concurrent programs isn't a particularly easy feat. Dealing with constructs such as threads and locks and avoiding issues like race conditions and deadlocks can be quite cumbersome, making concurrent programs difficult to write.

In this ...

remote echo
#

@hazy breach i didn't get ur question completely but, threading module might help. threading.timer or something. Set timer of 60s

hazy breach
#

Thank you @magic falcon and @remote echo

hazy breach
#

Thanks @sonic root, I'll check it out

lilac holly
#

anyone here familiar with syscalls?

#

got a question about virtualprotect vs ntprotectvirtualmemory

tulip sail
#

@clear needle

stone kayak
#

I have an API that users (probably malicious) will use. I can either:

  • Have them write to an S3 bucket their input, a program will check their input and then commit to database if valid (and not malicious). Delete the S3 items.
  • Have them write to the database, perform a query to find all unchecked items and then calculate if malicious / valid input. If it is, tick a box and put it into S3.

Which one is better? I'm also storing a manual backup in S3 (hence why it puts it there in the 2nd point). Should I go #1 and stop the manual store?

brazen eagle
#

you can rate-limit the API

brazen eagle
#

but for validating, that seems overly complex

#

why not pass it through a validation function which forwards it to the api if it's clean?

#

or is said input a file?

stone kayak
brazen eagle
#

feels odd, but without knowing anything about the input or the api it's hard to say

#

sorry

stone kayak
#

Sure, the input is a hash : plaintext: type, the validation is validating that hash(plaintext, type) == plaintext. This is expensive and takes around 1 - 2 seconds depending on the type 😅

brazen eagle
#

ah ok

stone kayak
#

I think letting them build up and validating all in one go, say once per day or so is cheaper than validating on the fly

brazen eagle
#

hash(plaintext, type) == hash no?

stone kayak
#

especially with a Lambda function haha

stone kayak
brazen eagle
#

naw

#

the former then

stone kayak
#

I think writing to the DB is fine, I can rate-limit to 1mb / day as 1mb is fine ? 😄

brazen eagle
#

1mb is pretty huge

stone kayak
#

API gateway limits all requests to 10mb, whereas S3 would be unlimited lol

stone kayak
brazen eagle
#

can you rate limit to n/s to avoid DDOS

stone kayak
#

yeeee its limited to 1/s, the DB only supports 5/s anyway 😛

brazen eagle
#

right

#

so caching results for a day and processing as a batch seems alright, so long as there is no expectation that the input is queryable immediately

#

you can always batch at a shorter interval

stone kayak
#

its probably better if i write a short lambda func to check how many unverified things are in the DB and if it reaches a threshold, run another lambda func? that way its not determined by time but by usage 😄

brazen eagle
#

maybe

stone kayak
#

and that shorter one can run a lot more since it'll only exist for a few ms

#

ah wait, i can just do that check in the main lambda func anyway -- so if there is stuff to add, add it else exit?

brazen eagle
#

might save the spinup time

brazen eagle
#

so... I had an idea for a program that could upload a reverse shell payload to the server, but then realized that I'd probably need a reverse shell already to use it...so that's dumb

#

maybe a thing to setup a webserver and startup a socat listener

stone kayak
magic falcon
#

Short answer: don't use SQLite

onyx merlin
#

That's far from helpful

#

Sqlite is decent for smaller projects

brazen eagle
#

or locally stored DBs

#

it's heavily used in Android/iOS projects

magic falcon
#

That's fair. I've never had a positive experience using it; eventually every app I've worked on migrates to using a more robust database and it causes many problems

#

What's the usecase? And what's the problem you are getting?

brazen eagle
#

I see it used a lot for config storage

#

which is silly

magic falcon
#

There are backend problems - sometimes strings don't convert correctly

#

Honestly, best use for SQLite I've seen so far is CherryTree

#

Kratos, what's the issue you are running into? I'm more familiar with Postgres and MySQL, but I've also used SQLite several times

magic falcon
#

did you enable foreign key constraints?

dry trench
#

const { Console } = require('console');
const express = require('express');
const app = express();

app.set('port', process.env.PORT || 3000);
app.listen(port, () => {
Console.log(Listening on port ${port});
})

cursive orchid
#

when asking for programming help, remember to let us know what's happening vs what you expect to happen

#

include errors etc

dry trench
#

im making a auth

#

errors Error: Cannot find module 'express'
Require stack:

  • C:\Users\Administrator\Desktop\Auth2\app.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (C:\Users\Administrator\Desktop\Auth2\app.js:2:17)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ 'C:\Users\Administrator\Desktop\Auth2\app.js' ]
    }
#

thats the errors

#

i want it to say Listening on port ${port}

#

as you can see

cursive orchid
#

okay well that error means that express is not installed

dry trench
#

ok cool

cursive orchid
#

you need to install via whatever package manager you are using (probably npm i express)

dry trench
#

got it

#

lets see if it works

#

TypeError: process.env.PORT is not a function

#

umm

cursive orchid
#

yep

#

do you know much javascript?

dry trench
#

no wait i might fix it

cursive orchid
#
const { Console } = require('console');
const express = require('express');
const app = express();

app.set('port', process.env.PORT || 3000); // This line is the problem
app.listen(port, () => {
    Console.log(Listening on port ${port});
})
#

also, that's not how you want to be setting the variable for port

dry trench
#

ok

cursive orchid
#

also i have no idea what that Console module is

dry trench
#

someone said to use it

#

what is a Console module

cursive orchid
#

a typical basic express app looks like this

const express = require('express');
const app = express();

const PORT = 3000;

app.listen(PORT, () => {
    console.log(`Listening on port ${PORT}`);
})
#

you are bringing in a module called console, i suggest reviewing some javascript/node basics before jumping into creating express apps

dry trench
#

im making it for a app someone asked me to make a auth for it

spiral wren
#

You agreed to hammer down some nails without knowing how to use the hammer :)) You should do some nodejs and/or JavaScript specific materials. There are lots of free resources on YouTube, or if you're okay to spend some money, there's a Nodejs course on Udemy by Andrew Mead that is great

lilac holly
#

can someone explain this to me?

#

i got stuck on this code earlier, still havent completely figured it out

#

the '../..' part specially

#

i really cant understand

true pumice
#

@lilac holly No.

#

That is from a room

#

No hints until tomorrow @ 7pm.

#

(as per rule 13)

lilac holly
#

can someone explain in private then? i already completed the room but i didnt understand this code completely

#

the filters

#

got me a bit confused

pearl zephyr
#

But writeups are already out i guess🤔

true pumice
#

Are they?

pearl zephyr
#

Yeah

true pumice
#

That's v/ annoying

#

I guess it's fine if writeups are out

lilac holly
#

@pearl zephyr u can dm me if u want, pls 🙂

pearl zephyr
#

Also @lilac holly its strange how u completed the room without understanding how filters work

true pumice
#

I'm still not sure of the rules here.

pearl zephyr
lilac holly
#

@pearl zephyr i already tried the ../.. thing but it didnt work

#

so i didnt really need to see this code to know

#

but when i saw it i thought it was a bit confusing

pearl zephyr
#

@true pumice i guess its fine to explain the code if writeups are available🤔

true pumice
pearl zephyr
#

Ok

digital dove
lilac holly
digital dove
#

That's not a lot. 😄

swift crown
#

“Intro to python” room has been removed?

foggy hazel
swift crown
foggy hazel
#

For some reason I can't get my table to have foreign keys

stone kayak
fathom idol
#

Hi, I have managed to capture some Dot11Auth and EAPOL frames using sniff in scapy. I do not capture all of the frames, normally I get frames 2 and 4 of the EAPOL key frames, is there a way I can capture more. I understand scapy sniff can be a little slow to capture frames and packets

#

I was thinking an lfilter would be faster than checking the frames in the prn function, but I dont know myself

#
def parse_packets(packet, output):
    if packet.haslayer(Dot11Auth) or packet.haslayer(EAPOL):
        print("Saving frame")
        wrpcap(output, packet, append=True)
...snip...
 sniff(filter="", prn=lambda p: parse_packets(p, outpath), store=0, iface='wlan0mon')
autumn bane
#

guys i have a problem and idk what it is

stone kayak
#

ok then we cant help much sorry 😦

safe oriole
#

Hello guys , is there someone who is experienced with IDS systems and detection of web app attacks ?

sharp coral
#

im not terribly experienced but I do have a working IDS/IPS set-up for my homelab, what is your question?

safe oriole
#

which IDS system are you using ? i am wondering what approach should i use in order to detect for example XSS attack on my web app

#

maybe some kind of anomaly detection or ?

sharp coral
#

i've used an ELK stack, suricata, snort and splunk - splunk will be the easiest to get up and running

#

filter a search for access logs on the web server, probably filtering for POST requests - manually enumerate your webapp and look for likely vectors of attack and filter those points

#

then set up an alert in splunk for requests on that endpoint

#

suricata's eve logs are good for anomaly based detection too, can also be indexed by splunk

magic falcon
# foggy hazel Wydm?

A "normal" build of SQLite doesn't support foreign key references. To make it work, you need to either re-compile your SQLite engine, or else download a version that has it enabled

magic falcon
safe oriole
sharp coral
#

detection not prevention juun

magic falcon
#

Droogy's solution is less what I would think of as being IDS and more being log analysis - my understanding of IDS is that its usually done in real time on layer 3

#

Firewall mfg (fortinet, ubiquity, cisco) all offer IDS options for their pricier appliances

sharp coral
#

well tbf there is no intrusion detection without logs to analyze

#

don't try and reinvent the wheel and build your own IDS, I mean i guess I would start with building some sort of front-end or even basic cgi-script that will essentially tail -f access.log

foggy hazel
safe oriole
magic falcon
safe oriole
#

so my question is , what is probabbly the best posible way to analyze theese logs

sharp coral
#

gotcha, this would be a good place to start, suricata rules contains malicious signatures, there are thousands upon thousands of these rules, you can incorporate the attack signatures into your own db and figure out an interesting way of indexing them maybe https://github.com/jpalanco/alienvault-ossim/blob/master/suricata-rules-default-open/rules/1.3.1/emerging.rules/emerging-web_client.rules

magic falcon
safe oriole
sharp coral
#

ahh okay yeah I hear ya, there is definitely a lot of blending between the terminology, they both work best when used together but a SIEM is the aggregate of all alerting and events, an IDS is just a little piece of the entire security posture

#

yup! hard to think of a better way when it comes to web-apps to filter for malicious activity than good ol regex

#

if it's for a thesis, you also may want to look into setting up a honeypot web-app on a VPS for some live data

safe oriole
#

yeah i am using DVWA for that purpose

#

i allready have some SQLi regex rules but i think its really easy to bypass them

#

for example if u try to catch ' order by 1 --

sharp coral
#

ahh having DVWA connected to the internet sounds like a really fun project 😄

safe oriole
#

u can still do ' or/asd/der by 1 --

sharp coral
#

gotcha, you can still use regex in that case to look for mutations and edge cases, thats why suricata is so damn good

safe oriole
#

do you have some reference please ?

sharp coral
safe oriole
#

that will be a lot of work to create regex rules to catch everything

#

thats why i came here 😄

sharp coral
#

if you're focusing on XSS you might want to scrap DVWA and just build something custom specifically vulnerable to XSS and just hammer it

magic falcon
#

If its for school, your dept may have budget to help you out with buying some tools or hardware

safe oriole
#

i will probably take some inspiration from Suricata IDS

#

i just tought i was thinking wrong by using regex for this

#

anyways thank guys 🙂

foggy hazel
swift crown
#

Anyone have tried PTS preliminary programming

magic falcon
#

I'd rather you tell me what versions and the sourcing of your SQLite and python, first - code from earlier looked correct, and code won't matter if the db isn't enabled for what you want

swift crown
#

preliminary programming from INE

magic falcon
swift crown
magic falcon
#

is that a bootcamp?

lilac holly
#

Is this is a good resource to learn programming?

grave salmon
#

🤷‍♂️ not familiar

lilac holly
#

Are you self taught or go to school?

grave salmon
#

semi-both.. taught myself a bunch but I did have classes on java, data structures and algorithms, python, javascript etc in uni

lilac holly
#

Niice, thanks for the insight my guy

cursive orchid
#

that's that youtuber's site isn't it

#

the one who worked for google or smth

stone kayak
#

It's alright

#

he explains it poorly

lilac holly
#

What's the best and effective way to learn programming in your opinion? @stone kayak

magic falcon
#

^^^ This. Pick a project, figure out how to solve all the problems for it

lilac holly
#

Okay then! I will build a website for my gfs new startup business

#

And an app!

surreal bronze
#

Codewars any good?

thin lynx
#

what is the new technics in java for gaining files write's privilege in android?
android.provider.Settings.System.putString is deprecated now

#

i don't know how to use WifiManager

stone kayak
#

Why does this AWS API Model take empty string & no list?

{
  "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "lookup",
    "type": "object",
    "properties": {
        "Hash": {
            "type": ["string"]
        }
    },
    "required": ["Hash"]
}

I don't want it to accept when:

  • String is empty
  • Hash's value is not a list.

Currently this works (I don't want this to work as it's an empty string):

  • {"Hash": ""}

These 2 do not work:

  • {"Hash": []}
  • {"Hash": 6}

Why does it execute on empty string which isn't in a list, but empty list doesn't execute?

How do I make it so it only works if the input is {Hash: ["Hello"]} and not empty string or a single string?

Thanks for any help you can provide 🙂

#

@sly breach 🥺 if you do AWS API stuff do you know? ❤️

lilac holly
#

How much programming would I need to know in order to land a decent job ?

lilac holly
#

Software engineer or developer

cursive orchid
#

you'll ideally want to know the language the job requires inside out

brazen eagle
safe oriole
stone kayak
# magic falcon Can you link to the docs?
stone kayak
#

Lol

{"Hash": ["Hello", "yes"]}``` fails too
brazen eagle
#

I'll have to look up JSON schemas

hardy iris
#

try this^

stone kayak
hardy iris
#

🤔

stone kayak
#

Would be nice if AWS told you what that meant lol

hardy iris
#

i was playing around with aws and it worked tho

stone kayak
#

lemme try some json validators

#

ahhh

#

the comma

#

"name": { "type": "string" }, remove comma and it works

hardy iris
#

does it do what u need tho?

stone kayak
#

No :((

#

But thanks for trying!

#

These work:

{"Hash": []}
{"Hash": 6}
{"Hash": [9]}
stone kayak
#

I got it I think

#
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Hash",
    "type": "object",
    "properties": {
      "Hash": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "minItems": 1,
        "uniqueItems": true
      }
    },
    "required": [ "Hash"]
  }```
warped depot
#

that moment when you are sick of renaming files, that you make a python script that renames files for you xD

viral lance
#

howdy yall anybody here knowledgeable with .c files help me out does the .c file need some sort of exit command at the end of the file what tells the compiled binary to stop and exit ?

solar hull
#

the program will exit once it returns from main (or exit(int) is called)

sharp coral
#

hey all, about a week ago I had a good kata-like problem, just wanted to share my solution, would def appreciate some input as I may adapt this program into some crunch-like utility

Prompt:
I forgot a WinRAR-archive password. I remember there was a name of someone from my (hypothetical) family: jake, melissa, oliver, emily.
I remember there was a year of birth of someone from my family: 1987, 1954, 1963.
I remember there was a symbol:
["!","@","#","$","%","&","*","-","=","_","+",".",","]
But I do not remember an order of these elements.
You have to find a list of all possible passwords, based on this information.

Addendum: You must also create some way that the user can create a custom list.

import itertools

names = ['jake', 'melissa', 'oliver', 'emily']
years = ['1987', '1954', '1963']
symbols = ['!','@','#','$','%','&','*','-','=','_','+','.',',']
all_lists = [a, names, symbols, years]
# user input list
a = []
# check if we have cmd line args
if len(sys.argv) > 1:
    # check that custom(-c) flag is set
    if sys.argv[1] == '-c':
        # size of list is 2nd cmd line arg
        list_size = int(sys.argv[2])
        for i in range(list_size):
            element = input('add to list: ')
            a.append(element)
else:
    pass
master_pass = []
# permy does all the heavy lifting
def permy(single):
    # itertools magic to iterate over combinations
    list_iterator = list(itertools.product(*single))
    # join together tuple elements to form a password
    final_list = [''.join(tups) for tups in list_iterator]
    # add each password to a master list
    for i in final_list:
        master_pass.append(i)

res = itertools.permutations(all_lists)
for x in res:
    permy(x)

with open('all_passwords.txt', 'w') as x:
    for password in master_pass:
        x.write(f'{password}\n')
# debug master list
#for i in master_pass:
#  print(i)
true pumice
#

The else statement is completely pointless at the start.

#
else:
    pass
#
all_lists = [a, names, symbols, years]
# user input list
a = []

a is defined after all_lists so this should result in an error when run in some IDE's.

onyx merlin
#

Why does a exist at all?

true pumice
#

It's for "user input" it seems

#

I would probably do:

try:
# check if we have cmd line args
  if len(sys.argv) > 1:
      a = []
      # check that custom(-c) flag is set
      if sys.argv[1] == '-c':
          # size of list is 2nd cmd line arg
          list_size = int(sys.argv[2])
          for i in range(list_size):
              element = input('add to list: ')
              a.append(element)

# user input list
  all_lists = [a, names, symbols, years]

except:
  all_lists = [names, symbols, years]
onyx merlin
#

Oh it's used there

true pumice
#

Mhm, I do not see why a was used before creation 🤔

sharp coral
#

oops thats totally my fault,all_lists should be initialized right before master_pass - was copy-pasting code blocks

#

the try except is a good idea, was thinking of a way to handle no user-input

lilac holly
#

does anyone know if httputility.urlencode().tostring properly filters out XSS payloads?

silk prawn
#

where do you see it?

true pumice
lilac holly
#

i also found a similar resource that explains it a little bit better

#

but thanks

zealous tiger
#

anyone knows any good resources to learn coding? free if possible

sour apex
#

i'm writing a python script that loads a json file and downloads images from the links in it

#

how do i use it as an arbitrary script?

#

like just provide the file as as argument so it can be used on any json file

sharp coral
#

as for downloading images, requests module is the way to go

magic falcon
timid parcel
#

am i allowed to ask for help/guidance on this shopping cart i am trying to make? it is not school work but its still based around what i do in my classes. Just wanted to ask before posting. But at least i have created a few classes and functions in python for a very simple and basic online shopping cart. It is not supposed to use frameworks like django or flask, nor gui like tkinter. I have also created a html file, but what im currently struggling with is making the html file execute the functions in my python file
i can post the code if allowed to

brazen eagle
#

I assume your python is server-side

#

so you'll need to expose and call an api

#

usually via forms or javascript

timid parcel
#

well it practice based on assignments done in the past in the python course, so we have never had js, so its not for that

sharp coral
#

hmm sounds like you could maybe do something with cgi scripts if you need your code executed on the page?

#

feel free to post github link or something, not sure what code box limits are here, im assuming under ~50 lines is reasonable enough to not spam the server - should clarify with mod tho

timid parcel
#

yea okey, cheers! imma post it, and hope its okey

#

so this is the code i have this far at least. hope someone got some tips

clear needle
#

You could do it janky with a php shell exec

timid parcel
#

i think i was only allowed to use python and html tho:/ but ty for tip:)

clear needle
#

huh

#

Easier than I thought you can just use it in an action

#

so in your buttons or whatever you would just add an action tag

timid parcel
#

hmm, okey. thanks! i will watch it and come back to you if i have any questions:P

stone kayak
gusty crescent
#

I have a python dictionary dict = { 'a' : '', 'b' : '1' } whose values I'm calling with first = dict['a']. Since every empty string evaluates False, I'm replacing it with a zero if not first: first = 0.

Is there a possibility to let a for loop do that for me, so I don't have to write the if statement for every variable?

sharp coral
#
for x in dict:
    if dict[x] == '':
        dict[x] = '0'
#

you can probably get fancy with dictionary comprehension but this is probably the easiest way to get that done

true pumice
#

*This code has been untested.

If you are working with dictionaries, I would recommend using .items() when iterating over them.

for key, val in dictionary.items():
  if not val:
    val[key] = '0'

I would also recommend, Droogy, when writing code to use variable names that hint towards what the variable's purpose is:)

gusty crescent
gusty crescent
true pumice
#

I didn't test my version, gimme a sec to take a look ;)

gusty crescent
true pumice
#
dictionary = { 'a' : '', 'b' : '1' }
dictionary1 = { k : '0' for k,v in dictionary.items() if not v }

print(dictionary)

dictionary = dictionary | dictionary1

print(dictionary)

Output:

{'a': '', 'b': '1'}
{'a': '0', 'b': '1'}

This way is much better although:

def function(dictionary):
    return { k : '0' for k,v in dictionary.items() if not v }

dictionary = { 'a' : '', 'b' : '1' }

dictionary = dictionary | function(dictionary)

print(dictionary)

Output:

{'a': '0', 'b': '1'}

@gusty crescent

#

There's probably an easier way but this works so 🤷‍♂️

gusty crescent
#

never change a running system 😄

#

Thank you! give me a minute to test it

true pumice
#

Which version of python are you running?

gusty crescent
#

3.8.5

true pumice
#

Ah

#

That only works in 3.9

#

You would need to do something like:

dictionary = {**dictionary, **function(dictionary)} instead of dictionary = dictionary | function(dictionary)

#

I don't have 3.8 installed so you'll have to do some playing around :D

gusty crescent
#

Or I could just install 3.9 😄

#

and it works, thanks a lot 🙂

true pumice
#

No problem :D

gusty crescent
true pumice
#

Awesome !

sharp coral
#

appreciate the tips jabba!

true pumice
#

It's always great to build good habits:)

gusty crescent
# sharp coral weird, just tested

Huh odd, „but I swear it didn’t work when I tried“ cause now it works for me as well. And I even copied your code, so must’ve been a typo

balmy flint
#

Want to know how to remove the common elements with only the count of the another elements in a list
Lets say we have a list

b=[1, 2, 1]
the result which I need is [2, 1]```

Any help or tips !
true pumice
#

You want to remove duplicates?

brazen eagle
#

Looks like the complement

balmy flint
#

Not duplicate I mean the exact subtraction of list

true pumice
#

Uhh probably like

brazen eagle
#

Like a - b

balmy flint
true pumice
#
for item in list_one:
  if item in list_two:
    list_two.pop(item)
brazen eagle
#

Actually that would be like that in Kotlin...

true pumice
#

Actually

#

Which language

#

I presumed python lmao

brazen eagle
#

Looks like python

balmy flint
#

In python

#

Initially I tried with in operator but that doesn't work

brazen eagle
#

Hmm

#

If an item is in B but not A, do we include it?

balmy flint
brazen eagle
#

Basically but that's not terribly efficient

true pumice
#

Script:

a=[1, 2, 1, 2, 1]
b=[1, 2, 1]

for item in b:
  if item in a:
      a.remove(item)

print(a)
print(b)

Output:

[2, 1]
[1, 2, 1]
brazen eagle
#

What if b=[1,2,1,3]

balmy flint
#

We hav to exactly remove the common and print the entire remaining elements

brazen eagle
#

From both lists?

true pumice
#

I'm honestly confused

balmy flint
true pumice
#

Oh you're trying to compare the lists

brazen eagle
#

You need the complement of the intersection

balmy flint
brazen eagle
#

Or the difference

#

Intersect is the set in common

#

Complement is the opposite

balmy flint
#

Just I need the difference

true pumice
#

I'm confused

#

Do you want the elements that are in both lists

balmy flint
#

Am I confusing !

true pumice
#

Or remove the common elements from both lists

brazen eagle
#

You need (A-B)+(B-A)

true pumice
#
a=[1, 2, 1, 2, 1]
b=[1, 2, 1]

for item in b:
  if item in a:
    print(item)

Output:

1
2
1
brazen eagle
#

Apparently sets work but I don't know if they handle duplicates in python

true pumice
#

Sets changed since python 2 so I don't use them lmao

brazen eagle
balmy flint
#

Ok
I'm expecting like this
A = [1 2 3 1 2 3 1]
B = [ 1 2 3 1]
The result I need is [ 2 3 1]

brazen eagle
#

Yay google

balmy flint
#

Ok 👍

true pumice
#
a = [1, 2, 3, 1, 2, 3, 1]
b = [1, 2, 3, 1]

temp = []

for item in b:
  if item in a:
    if item not in temp:
      print(item)
      temp.append(item)
#

Output:

1
2
3
#

temp = 1, 2, 3

brazen eagle
#

Would that work if the lists were inverses?

#

IE b >a

true pumice
#

Seems to

#
a = [1, 2, 3, 1, 2, 3, 1]
b = [1, 2, 3, 1]

temp = []

for item in a:
  if item in b:
    if item not in temp:
      print(item)
      temp.append(item)
1
2
3
>>> print(temp)
[1, 2, 3]
>>> 
brazen eagle
#

Seems a bit odd but it's probably a pathological test case

#

That's finding the set of the intersection

#

Try with a = [1,2,3,4]; b = [2,5]

balmy flint
#

So we have to set the two lists and finding the difference is it!? But what if I need the elements which is not in A but in B ..just curious to know how to tackle

brazen eagle
#

That's why I said (A - B) + (B - A)

balmy flint
#

Oh noted now tks...

brazen eagle
#

You can also use (A + B) - (A intersect B)

balmy flint
#

Actually I am trying to solve a problem where we have to divide the given list into 2 halves irrespective of list length provided that the average of two lists are equal.. provided that first list have to have the first element in the given list...😀

brazen eagle
#

Hang on a sec while I parse that

vernal vigil
#

intresting problem , imma try it too

brazen eagle
#

So assumes sets S, A, B. S[0] is an element of A. Mean(A) = Mean(B)

balmy flint
#

Shall I post the screenshot ?

#

Of the question

brazen eagle
#

I think that mean(S) = mean(A) = mean(B) applies no?

balmy flint
#

Its a type of combinations and stuffs

brazen eagle
#

It's set theory, partly

vernal vigil
#

wait is it set of sets?

balmy flint
brazen eagle
#

Set can mean list here I think

vernal vigil
#

so

magic falcon
true pumice
#

Is this binary search?

brazen eagle
#

No

balmy flint
#

Ok It's midnight for me now Ill catch u morning guys...take care have a great day

brazen eagle
#

You can find the taeget mean easily

#

Target too

vernal vigil
#

i have seen this problem

magic falcon
#

this is a pretty common algorithms homework problem

brazen eagle
#

It's probable

#

I'd probably start by sorting the list

#

Then pick min, max, min,... Until I reach the target mean

#

Probably not reliable though

#

Seems to work for the examples though

vernal vigil
#

u take sum of all the elements in array,
you traverse the array and add elements one by one for subset1
and u subtract it from the total sum say its subset2
then you check if the average for both are same, then volla u got it(most likely)

surreal bronze
#

Ooo

vernal vigil
#

i have not worded it properly, after all this time

surreal bronze
#

What's going on here?

vernal vigil
#

Algorithms

#

Competitive coding, most likely

surreal bronze
#

Very nice

stone kayak
#

I just found a neat way to add threading to a program without knowing what threading is.

  1. Shuffle the input
  2. Run multiple programs
  3. Hope they never touch the same item at the same time, it's shuffled and if there's many items it'll be okay
brazen eagle
#

BOGOthreading?

magic falcon
#

i feel kind of sick at that approach to concurrency

stone kayak
#

Glad I could put my computer science degree to good use

magic falcon
#

that works until all of a sudden your race condition causes everything to explode

stone kayak
#

I'll burn that bridge when I get to it

magic falcon
#

fair

lilac holly
#

Hi, do anyone knows of a website to learn programming by completing challenges?

#

I wanna learn C as a beginner, but also I’m very into bash after the bash scripting room on THM. So if you know of just a list of tasks a beginner can complete, and learn programming along with it, would be very helpful

solar hull
#

Hackerrank, maybe?

stone kayak
#

check pins

#

there's loads

bright delta
#

@lilac holly there's a good intro to C course on udemy

#

"C programming for beginners, master the C language"

lilac holly
#

Thank you all, I’ll check the resources!

tribal smelt
#

anyone good with ajax/php?

bright delta
#

imo learning C is a bit different than other languages

#

ie, if you wanted to learn bash/python/ruby, I'd say, just come up with a project/go to hackerrank and go through them. With C, I think you should get a good overview of how it deals with memory/pointers/data types etc. it's a different paradigm

#

then once you have gone through a lengthy tutorial, then move to a project

lilac holly
#

I have basic assembly knowledge as I knew it’s what C is based on. Of course I don’t know everything so I wanna dig deep into it. I have some ideas of projects, so for now I’m gonna study it as much as I can

#

And thanks for the overview

severe sigil
#

looking for someone to HEX-EDIT an old 16-bit "DOS" game I wrote to unlock it. I cant remember the location to change to unlock the program. Anyone got time ?

steep musk
#

I need some help installing protoc for golang. I'm on an armel debian, and comiling my own crap is giving me nightmares.

lilac holly
#

Hi anyone knows any website to learn Ruby language or C language?

onyx merlin
lilac holly
#

oooo thank you so much

glass cape
#

can any bodu help me with it

#

2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.

What is the sum of the digits of the number 2^1000?

onyx merlin
#

Where is this problem from? @glass cape

distant shard
#

Project Euler

glass cape
#

it using python

onyx merlin
#

Python ints aren't limited

#

You can just... Do it

glass cape
distant shard
#

What type error?

#

Oh

#

Yeah, gotta convert it to a string with str()

true pumice
#

I'm confused on the task exactly?

distant shard
#

Find out whatever number 2^1000 is, loop over all the digits and sum them

glass cape
distant shard
#

Yeah

#

Convert it to a string

#

And then you can loop over it with a for-in loop

glass cape
distant shard
#

Well yeah

#

You gotta calculate 2^1000, store that in a variable, convert it to a string and then you can loop over the digits in the string with a for-in loop

true pumice
#

Ah I see now.

true pumice
#

(BTW you don't have to store 2**1000 in a variable)

distant shard
#

Yeah but I figured to keep it straight-forward instead of onelining it

#

@glass cape Sure

true pumice
#

Just unnecessary variable assignment

#

Why store it in a variable when you can directly iterate over it in the for loop?

distant shard
#

I'm just breaking it down

true pumice
#

??

distant shard
#

I found it easier to learn it by breaking it down into more lines

#

And then after getting it working, seeing how I could rewrite it in a shorter form, such as removing unnecessary variables.

gusty crescent
#

I'm trying to iterate over two excel tables at the same time using openpyxl (in this case both tables are on the same sheet) and paste a value of table A to the corresponding row of table B. I've tried this

current_row = 2
for row in ws.iter_rows(min_row=2, max_row=379):
    date_dissection = str(ws.cell(row=current_row, column=3).value)[:10]
    nerve_dissection = ws.cell(row=current_row, column=6).value
    id = ws.cell(row=current_row, column=1).value
    current_line = 2

    for line in ws.iter_rows(min_row=385, max_row=617):
        date_dmg = str(ws.cell(row=current_line, column=3).value)[:10]
        number_dmg = ws.cell(row=current_line, column=7).value

        if date_dmg == date_dissection and number_dmg == nerve_dissection:
            ws.cell(row=current_line, column=1).value = id
        current_line +=1
    
    current_row +=1

But its not doing anything or hangs. Also tried having the tables split to different worksheets, but with the same outcome.

sharp coral
#

dumb question but is this for a personal project? sounds like something you do with VLOOKUP if you just need a quick and dirty way of mapping values between tables

gusty crescent
#

yes it is, I'm a student so nothing I'd get paid for. I just like python and to automate stuff with it

true pumice
#

VLOOKUP function only works if the value is in the left column of table A so if it is then just use a VLOOKUP and then retrieve the data with python CSV

outer jewel
#

If anyone want a kickstart into writing their own shellcode, I've made a playground that has the following features:

  • compiles .c both to 32 and 64 bit (filename and filename64 respectively)
  • compiles .asm to 32 bit binaries
  • compiles .asm64 to 64 bit binaries
  • provides a shellcode runner that works for 32 and 64 bit
  • example shellcode for 32 and 64 bit
  • make raw will print the shellcodes as \x string

./bin/shellcoderun (echo -n -e (make raw | grep -v printf | grep -w 'shell' | awk '{print $2}' -))
Simply change the 'shell' to the name of your binary!
https://github.com/AlexanderBrevig/shellcode-playground/

stone kayak
#

If anyone knows system design (as in, from an engineering perspective not coding) if you could can you ask me some system design Qs in VC some point this week 🥺

lilac holly
#

can any1 suggest where i can learn php

#

now it's time i have to learn php

#

;-;

vernal vigil
#

w3schools?

lilac holly
sweet pike
#

Anyone have any experience with Vue JS/Axios and POST requests and willing to have a quick look at something? Not looking for someone to write code for me, as my logic works completely fine on my local machine (which leads me to think one of the server admins has potentially made a change), but would appreciate a more experienced eye to be casted over an issue i'm having.

brazen eagle
#

did you take latency into account with your promises?

sweet pike
#

I worked around the issue now, i used Fetch in async rather than Axios. I'm not entirely sure what was at fault specifically, but the fact it was working on my local instance and not the server itself (and the extra data it was returning at the top of the response) was strange. My data was being received, it just wasn't in a format i could access due to the additional data. Working with Fetch has circumvented that for now.

#

I tried a plethora of content-types and accept headers in order to fix it, but i know the issue was with Axios in the process, as debugging through each step the data was as expected right until the point it was returned into Axios.

vernal vigil
#

just a simple question:

for statement{
conditional statement #1{
conditional statement #2{
}
}
}

For this the time complexity should be n + 1 +1 , correct?

#

== O(n)

#

well nvm, problem seems to be the competition server.

brazen eagle
#

Should be O(n)

plain fog
#

Condition such IF is in linear time so it is assumed constant time. So there is only one loop so it means O(n)

tribal smelt
#
$(document).ready(function() {
    console.log("Is it even loading?");
  $('#submitLogin').on('submit', function( e ) {
      console.log("Is this doing anything?");
    e.preventDefault(e);
    var form = $('#login form');
    console.log("Form logged");
    
    $.ajax({
        url: 'authenticate.php',
        type: 'POST',
        // Get Form Data
        data: form.serialize(),
        beforeSend: function() {
            console.log("Checking...");
    },
    success: function( msg ){
        if(msg) {
            console.log("Worked");
        } else {
            console.log("Didn't Work");
        }
    }
    });
});

});

Can someone assist and tell me why this is unable to get the form data from within a modal?

#

infact. console.log("Is this doing anything?" doesn't populate in console

lilac holly
#

can u suggest me a hacking tool that i can code

#

cause i ran out of ideas in my project CyberCrack

lilac holly
#

hey guys

surreal bronze
#

Hey 🙂

#

How may we help @lilac holly

lilac holly
surreal bronze
#

Ah cool!

true pumice
#

If you need help with a room, please keep it in the room chat. This avoids spoiling the room for others.

half berry
#

oh cool, lemme delete that that then sorry

true pumice
#

No problem blobfingerguns

cursive orchid
#

what's the best way to design mobile first sites

#

should i just set a max-width and go from there?

graceful quartz
#

Spelling mistake there @cursive orchid

cursive orchid
#

where ?

#

OH

#

lmaoo

vague loom
#

👀

gray ledge
#

does anybody know of a good plafe to learn assembly

tidal panther
#

I know it only has limited exercises but exercism.io has assembly as a language to learn

magic falcon
gray ledge
#

alright thanks!

gray ledge
#

has anybody worked with the google sheets api?

tribal smelt
#

anyone here able to help me understand some documentation for a payment gate that I'm attempting to implement?

distant shard
#

I've been going through screenshots that my co-worker and I would take whenever we encountered "not-so-good" code. I found this beauty just now.

#

Or this beautiful memory leak that somehow made it past review. It would completely clog up your RAM within a couple minutes.

sour apex
#

I'm trying to modify an exploit for a machine on tryhackme. The problem is that there are two authentication methods. How can I stay authenticated and do the next authentication. The first one is a basic auth the next authentication can be done via the exploit itself. I need to find a way to persist the basic auth and then continue with the rest of the exploit. Can someone help pls?

brazen eagle
#

There's a way to get basic auth in the url

sour apex
brazen eagle
#

That it intended

#

It's actually once a minute

brisk sedge
#

Found an interesting, and rather short, whitepaper about using polyglot code to potentially evade antivirus software. I found it rather interesting since the author referenced a whitespace esoteric programming language (Jaws) to inject code into different types of files without disrupting their behavior while still being parseable as their intended purpose. I thought someone else here might also find it an interesting read. 🙂
https://scholarworks.uni.edu/cgi/viewcontent.cgi?article=1423&context=hpt

worldly cape
#

Hello

worldly cape
#

Does anyone know html/css

surreal bronze
#

Yes

#

What can we help you with

vernal vigil
#

Ask your question mate :0

distant shard
dark harness
#

so i want to start programming and coading any ideas

surreal bronze
#

check pins

magic falcon
#

Has anyone had any luck getting a GDB plugin to work with Ghidra?

radiant coyote
#

Does anyone have a good resource for Python pen-testing scripts or programs? I'm in the process of learning Python as my first language and thought it'd be helpful to dissect other programs to see what types of things are possible.

tidal panther
radiant coyote
#

@tidal panther thanks for that. I'll start digging through some code right away 😉

tidal panther
#

there is also the book but the book is python 2

radiant coyote
#

I'll definitely look into that too. My library keeps growing the more I want to know. My son will have an awesome collection to learn from once he can understand it all.

feral moss
#

Hello. I am about to learn python programming and i would like to know what is the best IDE you might recommend? I see PyCharm is ok 🙂

magic falcon
#

Pycharm is pretty good; it's what i use for my own coding. When i'm coding for work, I have a set of VIM plugins

#

largely because it is easier to SSH in than try to develop that codebase locally

true pumice
#

I would recommend downloading a bunch of IDEs and seeing which one you find is best fit; at the end of the day it’s what suits your needs.

surreal bronze
#

PyCharm is good but I find it's pretty heavy and takes up a lot more resources then other IDEs

#

I just use sublime text with my terminal

#

Its a text editor but it's great either way

tribal smelt
#

Can anyone look over a javascript and tell me why it isn't working

bitter field
tribal smelt
#

Well, you're gonna hate this as much as I do, can I dm you further information, so the link?

#

@bitter field

tribal smelt
#

Ty

radiant coyote
#

If you're a current student with the appropriate email address, you can get all of the JetBrains products for free.

sharp coral
#

if you're a student you should also apply for the github student developer's pack, its insane how much stuff you get - at least a thousand dollars worth of access to various software suites and stuff

tribal smelt
#

damn it javascript.

#

=[

stone kayak
feral pollen
#

Heyy i"m start learning network fundanentals

#

I want follow network pentest

#

So do you have some site for practice? Or resources for this major

stone kayak
stone kayak
#

For system design interviews (other than practice questions) I made a table comparing a bunch of technologies (rabbitMQ vs Kafka etc etc) might be helpful 🙂

mental storm
#

some programming lunguages for pentesters

#

?

onyx merlin
#

Python, powershell, bash, C#

clear needle
#

nim

#

only nim

#

always nim

#

nim solves all problems

remote echo
#

What's nim

eternal spindle
#

Who is nim?

stone kayak
#

nim is actually quite good imo

tulip sail
#

Loving Nim

gray ledge
#

i think that autocorrected from nano

stone kayak
gray ledge
#

WHY DID I READ THAT AS VIM

#

im going crazy

tidal panther
#

secret of nim

brazen eagle
#

Compiles to JavaScript, gods help us all

tulip sail
#

Fortunately it doesn't need to do that

brazen eagle
#

Their odd numbers iterator example is inefficient.

#

Better to return x + x + 1 for all x in positive integers

#

You can do 2*x + 1 as well though the compiler might optimize that. But avoiding division is probably for the best, though %2 can be replace with &1

#

Ok I'm done

#

Actually... (x << 1) + 1 is probably best perf wise

stone kayak
brazen eagle
#

Definitely faster than modulo

#

Compiler might be smart enough to optimize that though

#

Dividing is hard

#

Adding is easy

#

Subtracting is just adding

#

Multiplying is a bit harder than adding but easier than dividing

onyx merlin
wheat forge
#

damn I can't send images in here

brazen eagle
#

Verify

wheat forge
#

is there any way that I can?

onyx merlin
#

!docs verify

narrow terraceBOT
wheat forge
#

oh thanks

brazen eagle
#

Jumping is relatively expensive in systems as well so avoiding conditionals is good

wheat forge
#

they compile to the same thing

brazen eagle
#

Smart compiler

#

Looks like it's doing the add actually

wheat forge
#

interestingly these don't

#

yeah

brazen eagle
#

Yeah ok I can see why

#

The add is probably faster

wheat forge
#

although this optimises to just return 0

brazen eagle
#

Shift registers need a clock cycle

wheat forge
#

nice

#

this optimises to a shift

brazen eagle
#

Ah mod 2 is doing a shift right