#programming

1 messages Β· Page 28 of 1

cursive orchid
#

got some encoding issues

#
ntds = request.files["ntds"]
ntds_data = ntds.read().decode("utf-8")

print(ntds_data)
#

this works fine when i upload from my ubuntu machine, but not windows

#

wait

#

ok nvm looks like it is working now

clear needle
hoary jay
#

Guys i don't know if this is exactly the right channel for termux, I wanted to ask if you have any ideas on what projects I could do on vacation with termux in my phone
I already added youtube dl and the ability to download any video by just clicking share to termux
And i use it to ssh in to my nextcloud server

#

The best utility i see is using it for simple scripts or utilities like seeing what other devises are in your network

#

I know you can do that with nmap but it would be nice if there was a cli program to show the model of the device too based on their MAC addresses

pure zenith
#

hey guys new here

#

working on some API's , hope this channel can help me on some tips πŸ™‚

warped axle
hoary jay
#

Yeah I'm already in pain by using it πŸ˜‚, but I'm on vacation and i want it purely for educational purposes and not anything serious

#

That's why I'm looking for any projects i could try

#

nmap would be great if it could show the model of the devices too since you can easily identify any weird behaviors

#

And i don't like downloading apps like fing only for that

solar palm
#

Best way to learn more via your phone is probably watching videos πŸ™‚ For example LiveOverflow etc.

onyx merlin
#

Best not to scan stuff you don't own.

hoary jay
onyx merlin
#

Advice still applies.

hoary jay
#

I just want to replace applications like fing with simple commands in termux

hoary jay
solar palm
#

any terminal commands would also work on termux right, its just a terminal emulator just like putty/iTerm/Terminator/etc

hoary jay
#

It depends on if you can install the needed package

#

And if the command needs Saudi

solar palm
#

sure, without packags you're left to the built-in commands it provides

#

but you should be able to run any TUI applications

hoary jay
#

Probably yeah

solar palm
hoary jay
#

Nice thanks i will check it out

hoary jay
solar palm
#

As long as all the legitimate users on the wifi network are aware it shouldn't be a problem. But keep in mind that local laws and regulations vary a lot on these subjects.

#

so make sure you know about the ones in your country before getting yourself into trouble potentially

#

(Dieser Artikel ist auch in deutscher Sprache verfΓΌgbar) The laws on computer crimes have become stricter in Germany where the creation, use or distribution of so-called β€œhacking tools” have been banned. On 23 May 2007, the Committee on Legal Affairs of the Bundestag (the lower chamber of Germany’s Federal Parliament) approved a controversial go...

crisp elbow
#

$password = Get-ChildItem -Recurse -path c:\users\Administrator\Desktop\emails\ -file | % {select-string -path $_ -pattern passwords}

#

this command look for string passwords in the specifeied path recursively. How do i make this to find the string passwords case insensitive and also that it gives me a match if its find half of the string like pass etc

solar palm
# crisp elbow this command look for string `passwords` in the specifeied path recursively. How...
#

you could change 'passwords' to a regex of your choice, in this case you're indeed only looking for exactly that string

crisp elbow
#

so how would we do that

#

i am reading the microsoft docs about select string and regex

#

its going all over my head

magic falcon
#

Do the examples make sense?

crisp elbow
#

few

#

it says that the value we specify to -pattern is a regex

#

so what do i pass there if i want the powersehll to find all strings like ,passwords,password,pass etc

#

sorry i am just new to powershell and AD\

magic falcon
#

How much do you know about regex and pattern matching?

lilac holly
solar palm
#

learning about regex is not something I'd recommend postponing, it will keep coming back both as developer and in analyst positions :)

#

https://regexcrossword.com/ is a nice gamified way to learn :)

glossy iron
#

And don't forget regex101.com , very useful for testing and building search patterns.

onyx merlin
#

I think I use regexr for that

glossy iron
#

Also a good one. Regex isn't something I enjoy much, I find any time I need to reach for it, I usually have to re-cover the fundamentals lol.

jaunty sparrow
#

Β±

brazen eagle
#

Can confirm, both those sites are great

stone kayak
#

I am biased but another great way you can learn regex is to contribute to PyWhat, we run into some advanced regex problems or you can do basic regex if you want https://github.com/bee-san/pyWhat

GitHub

🐸 Identify anything. pyWhat easily lets you identify emails, IP addresses, and more. Feed it a .pcap file or some text and it'll tell you what it is! πŸ§™β€β™€οΈ - GitHub - bee-san/pyWhat: 🐸 I...

#

Also we provide mentorship if you get stuck or don’t know what to work on, a great project to contribute to and put on your CV or talk about when an interviewer asks β€œtell me about a time you worked in a team”! https://discord.gg/HswbH6N3D3 for the server, #what in that server and we can help you out :))

fleet vortex
warped axle
#

That might be the web site detecting that its a bot connecting to it

#

Just maybe tho

tulip ibex
#

in python when we print from a list from a for loop..
example:

a = ['apple', 'banana', 'ball', 'bat', 'bag']

for items in a:
    print(items)
#

how could i seperate all the items with a comma

#

fixed it

#
a = ['apple', 'banana', 'ball', 'bat', 'bag']
print(','.join(a))
#

how would we achieve this if the list was integers?

#

fixed it ;)

#
a = [1,2,3,4]
print(",".join(map(str, my_list)))
tiny meteor
brazen eagle
#

Several improvements to make: parameterizable user, target and word list. Threading as well

#

Fix the spelling

tulip ibex
#

attempting spelling

tiny meteor
#

F my english.

brazen eagle
#

Command line params are better

tiny meteor
#

thanks i will try em and update

brazen eagle
#

Look up argparse or something to that effect

late flower
#

sys.argv

brazen eagle
#

Here a gift :)

#

Naw, argparse is great

tiny meteor
brazen eagle
remote echo
#

So print adds , in end instead of newline

#

Or there is also sep

#

U can just pass array like print(*a, sep=", ")

#

Ig

brazen eagle
#

The join is pretty good though

solar hull
#

ig that depends on the size of data. Looping and printing (or writing somewhere) might be more efficient than joining strings.

brazen eagle
#

Probably, though the spread operator is pretty slow as well

#

Joining is easier to read though

glossy iron
#
const arr = [1, 2, 3]; 
const appendCommaToVals = arr =>  {
  arr.forEach(val => {
     arr.indexOf(val) === arr.length-1 ? arr : val +=","; 
  });

  return arr; 
}
const newArr = appendCommaToVals(arr);  
console.log(newArr); 

This would do the trick in JS.

brazen eagle
#

won't that add a comma after the 3 as well?

glossy iron
brazen eagle
#

Yeah that's a bit of a mess

solar palm
glossy iron
#

Got my head around it now I had a minute. This is a much better way of doing this:

const appendCommaToVals = arr => arr.map(val => !arr.indexOf(val === arr.length-1) ? val +="," : val); 
console.log(appendCommaToVals([1,2,3]));  
brazen eagle
#

I still think that join is easier to read πŸ˜‰

glossy iron
#

Yeaah, definitely comes down to preference.. I tend to avoid npm packages if I@m capable of writing custom code for something, and I tend to lean a little heavily on template literal syntax. But, that's just my approach πŸ˜„ .

brazen eagle
#

depends on how complicated the thing I'm trying to do is with npm for me

#

Library code is great, but npm has taken it to an extreme...

glossy iron
#

For sure. I think I'm just very cautious of falling into the trap of using pre-written code too often and getting rusty when it actually comes to needing to do something custom.

#

Things like surrounding ecosystem (think Redux or Firebase or such when building in React) , I'll quite happily pull in though lol.

solar hull
magic falcon
#

there is a huge difference between using std lib stuff and 3rd party

#

.join() is the most unchanging, most pythonic way of doing string concatenation. it's not like that NPM lib a few years ago that got taken down by a developer having a tantrum that caused a worldwide node outage

remote echo
#

Tbh,all he wanted to do was print it, not convert it into string to manipulate/use afterwards

#

That's why i said sep haha

rich wave
#

Does anyone familar with C# and it's delegate function callback with Winwdows 32API?

#

😒

brazen eagle
magic falcon
brazen eagle
#

yeah that was great fun

magic falcon
#

When that happened, I was super glad I was not working with anything node

brazen eagle
#

same

glossy iron
#

Random question for you folks; does anyone develop their own exploits, scripts, shells etc, and if so, can you offer thoughts on things to consider in the process or getting into this side of things?

true pumice
#

I've created a few automation scripts.
Not sure what you are looking for but it's usually:

  • Come across something
  • Think I can make it easier
  • Make a script through looking at modules and what I need etc.
surreal bronze
#

If its something I have time for and I know i'll make it better then i'll take a shot at it

sharp coral
glossy iron
#

I do plan to pick up some powershell and bash skills very soon.
At the moment, I've been aliasing a repetitive task to a fish command, but eventually I'd like to look into things like exploit creation etc.

magic falcon
glossy iron
#

Yeah, DRY is life.

sharp coral
glossy iron
#

I'll definitely have to take more of a look into bash and bash scripting soon then.

I have access to a premium pluralsight account via work, so chances are I'll hit that up for that.

coarse yew
#

Im new to this so, what is DRY?

onyx merlin
#

Don't Repeat Yourself

coarse yew
#

Oh..

#

Well that is awkward.

#

The only programming that I am fairly aquainted is Python

#

ahhh T.T

remote echo
#

DRY basically just means that don't repeat same code again and again, like of you want to do something multiple times, then write a function/loop for it instead of writing same code again and again.

Not a language specific thing

#

just like a basic principal

tulip sail
#

Even if it's literally just being used twice, stuff it in a lambda function πŸ€·β€β™‚οΈ

#

Repeating your code is tedious, and also makes you significantly more likely to introduce bugs down the line. Not worth it

steel vigil
#

Ola, does someone has an advanced free question on C++ programming?

#

questions*

#

maybe a site?

spring rune
#

I am struggling to get my head around discord.py. How do you go about learning new libraries in general? Difficult question to answer briefly but maybe someone has some advice!

stone kayak
#

I just struggle until I get it 😦

spring rune
#

Hehe yeah! I Guess thats the solution in the end!

surreal bronze
#

If it doesn't work, you research why it doesnt work

#

Now you've learnt how to fix it and something new

#

Repeat

spring rune
normal sable
#

Anyone know of websites similar to DVWA that I can host? I'm building a web app vuln scanner so the more websites I can test the better

brazen eagle
brazen eagle
tulip sail
#

(That's what I meant by adding bugs)

brazen eagle
#

also experiment

#

unit tests are a good way to play with an API to see how it works

spring rune
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

brazen eagle
#

piece by piece

#

it's always a divide and conquer scenario

spring rune
#

yeah! Thanks for the advice. I am going to dig into it

#

if one conquers one i guess it will become marginally easier over time

fresh falcon
#

Making a script in Bash that I want it to detect which desktop environment i'm using. Is there a recommended way to do it? Using "ps -e |grep kde" or something like "echo $XDG_CURRENT_DESKTOP" or something else?

brazen eagle
#

I'd probably trust the env var

plain path
#

javascript - how come the middle msg still prints last even with timeout 0?

#

is there a hard rule that all synchronous code will run before any async code will?

glossy iron
#

@plain path , in this case, the order of operations is affected by the callstack (queue of when things will run) .
Your code here will parse top to bottom and follows this logic:
Line 1 - synchronous, run immediately (and as it's simple, no blocking process to wait for)
Line 2 - Okay, it has a timeout, which is an asynchronous operation, but it's set to 0... so let's add it to the queue to be invoked once everything else is dealt with
Line 3 - repeat of line 1

Once those are done, it looks at the queue and goes "oh, wait, I also have this operation under the set timeout to run, let me go do that now".

brazen eagle
#

pretty much, Javascript is wierd sometimes

plain path
#

so p much what I said

#

thanks lads

#

why is the syntax " throw new Error('blabla') " ? I mean looking at this would have me thinking its always gonna throw an error since theres no conditional, no catch block

solar palm
#

it would only reach that part when not having hit the return statement right

plain path
#

oh thats right

#

my nad

#

once it returns it stops the rest from running

#

in this way theres no conditionals necessary, makes sense

#

thanks chief

glossy iron
#

Another way to look at this one, is yes, once it hits the return you're exiting out of the function, but also a ternary approach of "if this happens then this, otherwise, throw a new error.

To explain that, another way to write that could be:

response.ok ? response.json() : throw New Error('request failed!');  
wispy kestrelBOT
#

Gave +1 Rep to @glossy iron

thorny meteor
#

guys which one better progamming for cyber security java or python?

tulip sail
#

Python for scripting.

#

Knowledge of Java is very good though

thorny meteor
#

oh okay thanks

graceful quartz
#

Learning the core concepts of programming is a huge bonus. Means u can quickly pick up other languages and have the ability to read most languages and get a general idea.

glossy iron
# graceful quartz Learning the core concepts of programming is a huge bonus. Means u can quickly p...

This x 100.
Try to learn concepts and transfer them, rather than learn just a particular language;
variables, primitives, arrays, objects, classes, loops, all that sort of good jazz.

Once you've picked up these basics, you'll find you can comfortably switch between languages as needed (or pick up a new language much faster, as you're only learning the syntax of those concepts in that particular variant). @thorny meteor .

wispy kestrelBOT
#

Gave +1 Rep to @glossy iron

stone kayak
#

Go Channels are so cool

onyx girder
#

@stone kayak what are go channels

stone kayak
#

yeah i know i just spent 2 days of my job learning about them but i dont know

#

you shove stuff into them

#

and the other side receives them

#

like a train i guess

onyx girder
#

are they part of golang @stone kayak

mortal flint
#

sounds like a queue

onyx girder
#

yeah i guess

magic falcon
stone kayak
stone kayak
#

i havent even looked at them

#

i dont think i can have a race condition in my code anyway

#

its like 1 channel

#

and it just updates a variable

magic falcon
#

it's not a real race condition

#

I just don't like how I can't really check the status of the channel buffer

#

the buffer size of the channel is one of those things that seems like it gets really awful really quickly, if the type is anything other than a primitive

#

sending results back over a 2nd channel is really the thing that seems like it's slow

#

Can't even verify it because the go profilers are total garbage

brazen eagle
#

Aren't those like coroutines?

#

Still not sure I understand how go works though

onyx merlin
#

They can have a capacity, and read/writes will block if there's no room or nothing to read

brazen eagle
#

Gotcha

onyx merlin
#

Checking the number of items in a queue is a bit messy though

brazen eagle
#

I suppose the point is that you don't really care

#

Kotlin has a similar concept iirc

onyx merlin
#

Honestly, it's a great structure if you plan around using it.
It's made threading much more accessible for me

#

But if you misuse it or don't plan properly, you'll get slow or messy or buggy code.

magic falcon
#

It's also not nearly as transparent as writing an atomic queue.

#

To be fair, I've spent maybe an hour messing about with go channels. the goroutine structure doesn't map 1:1 to threads in other languages, which isn't bad. It does make planning threads a bit more messy from what I can see

placid goblet
#

How can we whitelist applications. I am working in a project of making an online exam platform, in that a user should be allowed to switch between applications which are allowed like Excel app for accounts calculation. Any suggestions on how to code this feature

onyx merlin
placid goblet
onyx merlin
placid goblet
tulip sail
#

You need a custom, locked browser @placid goblet, but even then those are ludicrously easy to bypass

#

Only way to prevent cheating is proctors

brazen eagle
#

pretty much

steel vigil
#

Any suggestions of C/C++/Python hacking libraries?

magic falcon
#

There aren't really hacking libraries per se.

steel vigil
#

Yes, but maybe something that I get started with?

glossy iron
#

Python cookbooks are a thing, I think.

steel vigil
#

Ok, I'll check

clear lodge
#

Hey, anybody here have a good grasp on K8s?

magic falcon
#

A few of us have worked with it... what's your question?

clear lodge
#

I have a dockerfile / docker-compose, which were working wonderfully before, launching a local author instance of the CMS I need.

A colleague of mine prepared a k8s manifest for deployment, but now after merging, when I run my ususal docker-compose build && docker-compose up from the root of my project it launches a local public instance instead ( while I need an auth instance ). To clarify, I kind of know my way around docker but have almost no experience with k8s

But I don't really understand how that is is possible, as I'm not running k8s right now? My own dockerfile and docker-compose havent changed. Do you know if it's possible that changes would somehow be picked up from the k8s manifests?

#

I can't really find the reference where k8s would decide to launch either local or author

#

maybe my author instance is actually running somewhere on some port... hmm

magic falcon
#

Are you using an image registry for k8s to pull from?

#

if you launched with kubectl apply or similar, then k8s will create the resources

clear lodge
#

not 100% sure if I understand the question correctly, but we have downloaded a webapp of this CMS with maven, and then wrapped that in an image and set config in the dockerfile. So I'm not pulling the image off of dockerhub for example

magic falcon
#

right

#

so do you have a registry, like nexus or quay or even artifactory?

clear lodge
#

I have several pom.xml files with the dependencies in there

magic falcon
#

that's not what i'm asking

#

pom.xml is maven stuff

#

so the typical (ideal? best practice?) workflow is to have some kind of image builder

#

docker build or buildah are common. Then docker push or skopeo copy depending on your toolchain, to get the image into a registry that your k8s cluster can access.

#

Then the YAML file for your deployment can be applied

clear lodge
#

okay, thank you. I have some googling to do now πŸ™‚

#

my colleague is in a different timezone unfortunately, hehe

magic falcon
#

I strongly suggest not messing with k8s internals, unless you don't care about breaking the cluster. It can be pretty fragile if you mess with a KubeConfig into a bad state

clear lodge
#

Yeah, I mean, I don't even really need it to progress with local development. I just need to find out why the public instance runs instead of author

magic falcon
#

If you aren't pushing the image to a registry, or telling k8s to use the local docker-registry instead, then you are launching docker instead of spooling up a k8s Deployment.

#

This is also kind of a shot in the dark, as I have no idea what commands you are actually running

clear lodge
#

I understand, this kind of thing is hard without context, no worries

#

thanks a lot for taking the time!

magic falcon
#

You welcome

steel vigil
#

Ola, How can I execute a .py file on linux , like nmap that I can just type 'nmap' and then just fill up some properties and just hit enter a run it?

cursive orchid
#

to find where python is located, type which python (or which python3) depending on version

#

then at the top of your python file do (but replacing with the location of your python)

#!/usr/bin/python

print(1)
steel vigil
#

thanks, I'll try that

tender path
#

any rooms for linux ???

brazen eagle
warped axle
#

Hey just a quick question here which layer in the OSI model is a UDP flood attack targeting?

#

Layer 3?

glossy iron
#

3 and 4 , iirc.

#

If I'm understanding what a UDP flood attack is purely by it's name, I'm going to go with it's a denial of service attack by sending the server or application more data than it can handle.
In this case that will mean directly sending many packets (frames, at this layer? πŸ€” ) , in quick succession, handled by the transport and network layer.

warped axle
#

Gotcha thanks @glossy iron

wispy kestrelBOT
#

Gave +1 Rep to @glossy iron

brazen eagle
#

I'd guess closer to level 4 though

glad glen
#

Hi all
Need some advice on which backend framework to learn between Spring and Django, aiming for a fullstack position(In the US)
I have 3 years of development experience, mostly in Java. I have worked with Spring boot and servlets, but not very proficient in them.
I dont have experience with python outside academics and CTFs
Regarding jobs, I prefer to work at older/mid-sized companies mostly, not startups
Should I continue on the Java ecosystem with Spring Framework or should I learn python and Django?

opal olive
#

Been a when since I checked, but I'm pretty sure most Django positions come as part of a larger data science gig

#

*while

#

Or ML

#

Not a SE so I could be wrong

magic falcon
#

I see a lot of jobs for Springboot, but not a lot of newer projects. Do you want the new hotness or stability?

#

As much as I dislike java applications from the infra management perspective, there are a LOT of java apps out there, and they all require engineers.

brazen eagle
#

So spring boot and Django are two completely different beasts for completely different use cases. I'm sure sure how scalable a python based web service will be tbh

cobalt kelp
#

What exactly manages how many users can be on my website at one? I have max 50 and after this no one can access the website, is it because of the hardware or are there any settings?

brazen eagle
#

hardware is one factor, how fast the server can process requests is another

cobalt kelp
#

yes

cobalt kelp
brazen eagle
#

CPU, memory, network capacity/speed

#

sometimes disk

#

the software used to host can be another limiting factor

cobalt kelp
#

network could be the problem, I don't have the fastest one

cobalt kelp
#

how do I know this?

#

I have created it with wordpress

brazen eagle
#

then no

surreal bronze
#

@cobalt kelp are you sure your self hosting, your not using the WordPress hosting?

cobalt kelp
desert harness
#

Hey, has anyone seen something like this used in programming ? some special characters ?

brazen eagle
#

could be shellcode

desert harness
#

this is something i found on webserver which have login on source code

#

it's for password as i understood

#

if password doesn't match it just gives me alert

shy hawk
#

Hi

cursive orchid
#

i have data like so:

[
    (537, 'Apple', '2021-08', '4bc2c030b3dad292edg23213cb089a11', 'another_pass', 'LM'),
    (538, 'Apple', '2021-08', '1bea7e93eb02719c87f72aeaaf822988', '', 'NTLM'),
    (539, 'Amazon', '2021-08', '45b4a8759f42df7f45655a75673c7585', '', 'NTLM'),
    (540, 'Apple', '2021-08', '5b9d1afcc9784729add5b1a41f2cb2c0', 'oop_cracked', 'LM'),
    (543, 'Apple', '2021-08', '1bea7e93eb02719cu7f72aeaaf822988', 'cracked_pass', 'NTLM'),
    (544, 'Amazon', '2021-08', '45b4a8759f42df7f45655a75673c7585', '', 'NTLM')
]

and i need to find every company that ISN'T using LM hashes, but i can't figure out how to πŸ˜”

#

so in this instance it should just return ['Amazon'] because they are the only company without LM hashes

magic falcon
#

MapReduce

cursive orchid
magic falcon
#

MapReduce, as an algorithm will get you the outputs you want

#

At a higher level explanation, it's a transformation to create associative data based on keys

#

in this case, i'd create a map of algorithms, and each algorithm would have an associated list companies that use it

glad glen
magic falcon
#

There are a lot of really cool features in Django - but it has not yet seen the adoption that Springboot has in industry. Go with what you feel, if you want stability, Springboot is it. If you want the new hotness that may not take off, that's Django.

steel vigil
#

Ola my old friends, What’s the equivalent of Variant Template in C++ on C#?

wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

lilac holly
#
def useListener():
    try:
        Listener = input(Style.BRIGHT + Fore.YELLOW + "\033[4mK1B0R(\033[0m" + Style.BRIGHT + Fore.RED + "Listener" + Style.BRIGHT + Fore.YELLOW + ")" + Style.BRIGHT + Fore.RED + ":> ")
        return useListener()
    except:
        'null'

framework = input(Style.BRIGHT + Fore.YELLOW + "\033[4mK1B0R\033[0m" + Style.BRIGHT + Fore.RED + ":> ")

if framework == 'use listener':

    listen = useListener()

    if listen == 'set LHOST':
        HOST = input(Style.BRIGHT + Fore.YELLOW + '\033[4mLHOST\033[0m' + Style.BRIGHT + Fore.RED + ':> ')

    elif listen == 'set LPORT':
        PORT = input(Style.BRIGHT + Fore.YELLOW + '\033[4mLPORT\033[0m' + Style.BRIGHT + Fore.RED + ':> ')
#

so im making an advanced reverse shell and listener for CTF's this is just a snippet of the code but what it is supposed to do is when you type "use listener" it puts you in the listener section where you can set your LHOST and LPORT. i want to make it where when you do "set LHOST <IP>" it sets IP variable as the LHOST and it calls back to the function "uselistener" and puts you back where you can input another option in the "listener" input so you acn for example do "set LPORT <LPORT>" but when i try to use any of the options like "set LHOST" it just doesnt work and calls back to the function any advice?

nocturne wedge
lilac holly
#

What do you mean?

#

@nocturne wedge

nocturne wedge
#

your useListener() function is recursive no matter the input

#

meaning it will keep calling itself and never exit

#

which is why you keep getting the K1B0R(Listener):> listener output after attempting to set a variable

lilac holly
#

How can i do that?

nocturne wedge
#

yes i understand, i'm writing something quick + adding comments so you can understand

lilac holly
#

Thank you so much if you can please continue this in dms

nocturne wedge
#

sure thing

dull sundial
#

How do I make THM dark mode? I'm no html or css expert (yet) I study mostly at night and want the white background to be something else.

lilac holly
#

Get browser extention called "Dark Reader"

dull sundial
#

I was afraid you'd say that. I'll look it up, thank you.

west solstice
#

Hey there, I have an elf executable when running it gives you two selections 1 and two. I want to write a python script that runs the executable and go over the selections

frosty ice
#

Anyone has VS2019 themes (or styles)?

cursive orchid
#

it's only gonna be 5 columns, all strings if that matters

#

also another question

#

my webapp has a file upload, and i read the data with request.files['file'].read() which works for small files but when i tried with a huge one it broke the app, i assume because of this:

If you want to use standard Flask stuff - there's no way to avoid saving a temporary file if the uploaded file size is > 500kb.
what's the best way to do this? just save the file to disk, do what i need to, and then delete it?

stone kayak
#

the key:value provides O(1) lookup (provided it doesn't hash to the same key)

#

I use DyanmoDB for the search-that-hash API

solar hull
#

this all depends on the type of operations needed.

desert harness
#

Hey, is there someone very advanced in PHP language ?

surreal bronze
#

Ask your question

tulip sail
stone kayak
#

Any C# programmers around who are willing to commit into looking into my problem, whatever that may turn out to be, even if it's not actually related to C# or if someone doesn't know anything about C# could actually answer my question?

brazen eagle
#

No.

surreal bronze
#

fyi the person who wrote it is 1# all time on stack overflow)

#

It's a fantastic guide for asking good questions

cursive orchid
wispy kestrelBOT
#

Gave +1 Rep to @stone kayak

magic falcon
# stone kayak NoSQL for sure

@cursive orchid I'll add in that the O(1) that Bee is talking about could be significantly dependent on disk access speeds. Super slow platters O(1) could be slower than O(log n) on NVME SSDs. Honestly, database engine really won't matter with that small amount of data. You don't really start to see problems with access speed until your app starts to thrash the heck ouf of the DB with many lookup requests. Your dynamic page tool will likely be the biggest bottleneck in your app regardless of which backend DB you pick.

frosty ice
#

If I remember correctly, it was Alessandra or something

#

oh it is Cassandra

solar hull
magic falcon
#

Yeah, a couple million rows isn't too bad - what will really kill performance of the RDB is table structure and indexing.

solar hull
#

Yup. and the kind of queries is what matters as well

#

If it's just key to value mapping, it's simple. Practically anything will do. If there's filtering or whatever based on the other fields, that might get heavy.

lilac holly
#
  s.bind((self.options["LHOST"], self.options["LPORT"]))
TypeError: an integer is required (got type str)```
#

any fixes?

lilac holly
#

yeah

lilac holly
# cedar furnace is this python?

just gotta know this quick fix because im releasing a project for beta access for some people and it needs to be done like rn x3

cedar furnace
#

what's the error

#

TypeError: an integer is required (got type str)

#

^ this?

solar hull
#

The error message is pretty clear. The types you’re feeding to the function are incorrect. You need to do something to correct the types.

cedar furnace
#

we need to add int

#

the IP address or the PORT are both integers

#

or tbh, add a float cause IP addresses are in the form of xxx.xxx.xx.x

remote echo
#

Float don't have format like 10.10.10.10 lol

#

IP shall be string

#

And port integer

solar hull
#

Yup, bind takes a tuple with string ip and int port as its argument.

magic falcon
onyx merlin
#

You can represent IP addresses (at their core) in binary as a 32bit int, but if you want it formatted like that then it needs to be a string or special type

#

You can in theory store it as a 32bit float, I think I've seen some crazy things there

#

I'm far from saying you should

onyx merlin
#

That's the only type that matter

solar hull
#

I guess you're using IPv6 daily although you don't notice that

#

(Mobile networks are mainly IPv6 in the core)

onyx merlin
#

IIRC some ISPs in the UK have really broken support for it

#

My first year university accommodation broadband had horrifically broken IPv6 support, had to be disabled

solar hull
#

A lot of end-user deployments of IPv6 are broken.

wanton merlin
surreal bronze
#

Could you provide the code? @wanton merlin

wanton merlin
#

It's the one from the Black Hat Python book

#

Gimme a sec

#

The author doesn't provide a github repo, he just provides the zip file for all the code

surreal bronze
#

Ill look at it when I get home but from what im getting from the error msg it seems it's not assigned to anything - e.g the variable is like {}, [], '', None

wanton merlin
#

Oh wait I'm so dumb xD

#

def github_connect(): with open('t.txt') as f: token = f.read() user = 'user' sess = github3.login(token=token) return sess.repository(user, 'bhptrojan')

#

that's the part of the code that spits the error

surreal bronze
#

Okay, the login clearly failed because sess is a none type. I believe it's not getting the proper token, so check -> print(token) and see what happens πŸ˜‰

wanton merlin
#

Alright

#

BRUH I FORGOT TO PASTE THE TOKEN XD

surreal bronze
#

Haha no worries πŸ™‚

wanton merlin
#

Alright, it works perfectly now, thanks haha

magic falcon
#

token may also be scoped to the with open() block; python it shouldn't but sometimes python does weird things if you leave it up to implicit scope

tulip sail
#

As a matter of best practice, you'd be better doing that with environment variables instead of a file read as well @wanton merlin

thin lynx
#

What do i have to do for the iterate part? (via Python)
"MD5 hash a string and remove the last 16 characters of it. Iterate this process 50 times."

import hashlib hash = input("enter ur hash here: ") out = hashlib.md5(str(hash).encode("utf-8")).hexdigest() print(out) identifier = out[:-16] print(identifier)

surreal bronze
#

for loop I presume?

#

A while loop could do it as well

thin lynx
#

Thanks but i want the exact syntax

#

like main and while < 50

surreal bronze
#

Google it πŸ˜‰

thin lynx
#

I know πŸ˜„
but can't find a good solution for it

surreal bronze
#
for i in range(50):
     <code here>
thin lynx
#

for i in range(50): main rest of the code

magic falcon
thin lynx
#

It needs to iterate the out[:-16] 50 times

MD5 hash it and remove the last 16 characters of the hash. Iterate this process 50 times

magic falcon
#

Please don't iterate with the main entry point in a loop. That's one of the worst possible practices you could ever learn.

thin lynx
#

like MD5 the input hash
remove the last 16 characters of the hash
MD5 again the hash with removed character
x 50 times the above process

magic falcon
#

Are you familiar with slicing?

thin lynx
#

yes

#

Done 🍺

glossy iron
#
.typewriter {
  width: auto; 
  display: inline-block;
}

.typewriter p {
  background-color: inherit;
  font-family: 'Montserrat';
}
/* This is from CSS-Tricks.  Useful, but i don't know how to build that myself yet */
.typewriter span{
  font-size: 1.2em;
  font-family: inherit;
  padding-top: .5rem;
  color: #4AF626;
  width: auto;
  display: inherit;
  overflow: hidden;
  border-right: .15em solid white;
  white-space: nowrap;
  margin: 0 auto;
  margin-left: 10px;
  margin-right: 10px;
  letter-spacing: .18em;
  animation: typing 3s steps(50, end),
    

This was a portion of the code for the typewriter effect.

vocal summit
#

Hey guys, I'm new to bash scripting and I'm wondering how I can make this script print the last 20 characters of the variable "var" containing the named "value"

#

#!/bin/bash

var="8dm7KsjU28B7v621Jls"
value="ERmFRMVZ0U2paTlJYTkxDZz09Cg"

for i in {1..40}
do
var=$(echo $var | base64)

if ($var == $value && $var -gt 113469)

then

echo $var | tail -c 20

fi
#<---- If condition here:
done

vocal summit
#

nvm got it

brazen eagle
#

You know, it really annoys me when people say 'nvm I got it' without showing what they got. Also use ``` blocks to post code.

swift cairn
#

Is anyone here good at python linked list?

#

I need some help

#

Pls

lilac holly
#

just ask your question

swift cairn
#

I need help for crreating a method to retrieve an element from a specific position:get(i) or even llist[i]

#

Sorry for that question im just learning with linked list

solar hull
#

Are you writing your own implementation of a linked list?

#

If yes, think what you know of the list, and how you can traverse the list.

#

Hint: typically you know the head node of the list, and the next node of the current one.

swift cairn
#

Im so totally confused of that can you give some example sir?

swift cairn
solar hull
swift cairn
#

like 1 -> 2 -> 3
and i type:
n = 2
llist.get(n)
Output: 3

#

is this what it is?

#

C:\Users\Default.DESKTOP-E4GVIF1\Desktop>python -i test.py

llist = LinkedList()

fn = Node("A")
sn = Node("B")
tn = Node("C")
llist.head = fn
llist
A -> None
fn.next = sn
llist
A -> B -> None
sn.next = tn
llist
A -> B -> C -> None
el = 1
llist.get(el)
'B'

swift cairn
#

Thanks

solar palm
# swift cairn Sorry for that question im just learning with linked list

See https://realpython.com/linked-lists-python/ for some pointers on how tou typically do this with python

In this article, you'll learn what linked lists are and when to use them, such as when you want to implement queues, stacks, or graphs. You'll also learn how to use collections.deque to improve the performance of your linked lists and how to implement linked lists in your own projects.

lilac holly
#

Does anyone know how to call a win32 api function in python with ctypes if one of the function's arguments requires a pointer to a struct? For example, DuplicateTokenEx requires a pointer to a SECURITY_ATTRIBUTES struct, which I think is declared in Windows.h header file, but I don't know how to access that declaration through ctypes.

elder notch
#

hello, im following a tutorial on writing a linux debugger in c++ and i ran into this:

#

auto get_address() const -> std::intptr_t { return m_addr; }

#

i understand that the function gets the contents of m_addr and returns it as an intptr_t but im not sure what the arrow does in this context

#

is it just specifying the type as std::intptr_t for the auto keyword? id assume that wouldnt be necessary since the variable itself is typed the same way

hollow tangle
elder notch
#

ok. is there any benefit to doing this instead of auto get_address() const { return m_addr; }?

hollow tangle
wispy kestrelBOT
#

Gave +1 Rep to @hollow tangle

hollow tangle
#

Np πŸ‘

elder notch
#

another c++ question: in the tutorial im following, there are includes specified in a cpp file. im also writing headers that are included in that cpp file and use the types from those includes. however, when im trying to use those types in my headers, my editor (vscode) keeps saying they are undefined unless i explicitly include them in my header files. i noticed that the code for the tutorial doesn't have to do this. is vscode just not realizing those includes are there and it's actually fine?

#

for example, main.cpp has

#include <string>
#include "myheader.h"

when trying to use std::string in myheader.h vscode will say it's undefined unless i add #include <string> to myheader.h

magic falcon
#

Each .cpp file you write will usually include any number of headers - what you're describing is the intended behavior of compiling a C/C++ program. The headers need to be included otherwise your code won't know about the libraries you depend on.

#

There are some tricks to reduce how many times you need to type out the included headers, but as a beginner that will be a bit mind blowing to walk through (as most new concept in C++ tend to be).

elder notch
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

full delta
#

any good resources to learn js for pentesting? Ik that s a pretty dumb question but I just think that the materials on w3schools (for example) don't help me at all with what I wanna learn.

glossy iron
#

@full delta what aspects of JS are you trying to learn particularly? I'm a fountain of (mostly) free resources for that ecosystem. If you're able to identify which aspects you'd like to focus on / particular tasks you're looking to carry out that would help a lot.

full delta
#

I want to learn to do XSS

#

(idk if the answer is good enough)

#

but I guess I need to master the front-end Javascript before this

#

I worked in JS but I didn t do any frontend because I hate it. I did some NodeJS projects (server-rendered) if it's relevant.

glossy iron
#

I mean, JS is JS is JS. It's one of the good things about the language; once you understand it's fundamentals, it's more about then using those to do what you need. JavaScript can be as basic or elegant as you like it.

full delta
#

it s pretty hard to remember all of the methods and the ways you can do DOM

magic falcon
#

That said, JS is applicable to niche use-cases, such as XSS.

tulip sail
brazen eagle
#

The rest is accurate though

glossy iron
#

I agree, but if someone wants to just run some XSS and things like that, if they don't alreay know a language, JS is a good place to start.
For sure, it can be usurped rather quickly, but the ecosystem is rather vast, meaning that if you need to do something, chances are there's already a way.

#

And of course, if you want to get into type casting etc, you can't go wrong with TypeScript.

brazen eagle
#

Typescript at least has a moderately sane type system

glossy iron
#

Yep, and interfaces are a dream to JS.

brazen eagle
#

JS: interwhat?

#

Mucking about with prototypes always felt really dirty to me

magic falcon
brazen eagle
#

Node is terrible

magic falcon
#

No JS engine, to my knowledge, has any concept of namespacing, which makes it a non-starter in my view.

brazen eagle
#

Npm is worse

full delta
#

i forgor what interfaces are

glossy iron
#

I must admit, I'm a little blank on the whole namespacing space, haven't really hit a "traditional" language that uses them yet.

brazen eagle
#

Deno looks interesting if you want a JS engine

full delta
#

are those the empty classes that you inherit?

glossy iron
#

I know a few people who have hopped onto the Deno bandwagon. Haven't had a great look myself yet, but losing the node modules is a great start.

brazen eagle
#

Does JS even support namespaces?

magic falcon
#

I don't think it does.

brazen eagle
#

I suppose you can use classes

glossy iron
brazen eagle
#

Wrong reply?

glossy iron
#

yup πŸ˜… .

magic falcon
#

Are JS classes actually encapsulated though? The lack of namespacing means that every new import raises the possibility of a name collision. I don't want to go down that rabbit hole in a security review or accreditation audit.

brazen eagle
#

No idea, there's a ton of very odd behaviour in JS

tulip sail
magic falcon
# tulip sail Oh, I don't disagree that it's not very nice. That doesn't mean that it's not wi...

That's fair - even if it's widely used, though, I think I'll stand by the statement that it's more mis-used than used. Mainly due to the poor organization and management practices surrounding the entire toolchain. Any time a developer approaches a security engineer and opens with 'I have a project in JS....' that's the same feeling I got during my studies when a business student approached me and opened with 'I have an idea for an app.... It's like facebook but for [group of properly represented humans]'

tulip sail
#

I mean, I can't disagree with that one. It's not the nicest language to work in, and it's easy to make mistakes...

jaunty void
#

hey all, just joined

#

do we have any subs where we discuss tools? im looking for something that would fill and submit forms better than cypress

brazen eagle
#

What for?

jaunty void
#

im trying to see what else is out there

lilac holly
solar palm
jaunty void
#

im looking for a battle-tested framework for writing page objects and describing workflows for testing web apps

#

right now iv been doing that myself

#

for example... submit this form and expect either an error or a success page in the response

#

and do something else for each branch

#

it'd help when trying to investigate form submission workflow

stone kayak
#

I have a Lambda function which requires to be zipped (as it contains a library) before deployed.

I want the following workflow:

  1. Commit to GitHub Master
  2. CD automatically builds and deploys the Lambda

What is the absolute easiest system to achieve this? πŸ™‚

surreal bronze
#

You could use the lambda CLI and just the commands to zip it right? @stone kayak

#

That's what I do every time I make an update

stone kayak
#

also it'd need an AWS role which may be one stpe further than i want

surreal bronze
#

There's already an AWS role for it btw

stone kayak
#

for example, an AWS native product I'd be happy with it having my root role but CircleCI not so much πŸ˜…

#

I can do it in Concourse but I don't want to spend time setting up Concourse πŸ˜…

surreal bronze
#

Oh this article looked interesting

#

@stone kayak

lilac holly
#
        # Starting Socket Server
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        # Binding Server
        s.bind((self.options["LHOST"], self.options["LPORT"]))
#
    s.bind((self.options["LHOST"], self.options["LPORT"]))
TypeError: an integer is required (got type str)
#

any fixes been at it for a while

onyx merlin
#

...convert it to an int?

lilac holly
#

tried that

#

nothing

#

πŸ˜‚

#

man if you can figure out this problem like actually imma mail you a cookie ive tried soooo many things

mortal flint
#

Print the content of the thing you're passing in. If it IS actually an integer, then try parsing it into that type before/during the call

lilac holly
#

as i had said ive been at this problem for a long time now and havent stopped so my brain is technically mush at the moment can you please send me a snippet of what you mean of the code that i had provided i will also sennd the call aswell

#
class Listener: # listener class to house everything related to listener
    def __init__(self):
        self.options = { # available options to be set by user
            "LHOST": "",
            "LPORT": ""
        }

mortal flint
#

well, if you're passing in an empty string, there's your problem

lilac holly
#

no....

#
def useListener(self): # listener terminal 
        listener_input = input(Style.BRIGHT + Fore.YELLOW + "\033[4mK1B0R(\033[0m" + Style.BRIGHT + Fore.RED + "Listener" + Style.BRIGHT + Fore.YELLOW + ")" + Style.BRIGHT + Fore.RED + ":> ") # get input
        parsed_listener_input = listener_input.split() # split the input into seperate items in a list for easier access
        command = parsed_listener_input[0].lower() # setting the first item of parsed input (most likeley "set") to a seperate variable

        # checking the executed command

        if command == "set": # if set is used
            variable = parsed_listener_input[1].upper() # set the variable chosen (Either LHOST or LPORT) to the "variable" variable
            value = " ".join(parsed_listener_input[2:]) # set the value you specified to the "value" varaible
            if variable in self.options: # validation that the value exits
                print(f"{variable} -> {value}") # outputting the variable and value set to it
                self.options[variable] = value # actually setting the value specified to the variable name specified (LHOST or LPORT)

        elif command == "options": # if the command is "options"
            print("\n".join((f"{option} -> {value}" for option, value in self.options.items()))) # output all possible options that can be set with the "set" command

        elif command.lower() in ("run", "exploit"):  # potentially start the listener (i don't know what you want to do with this)
            self.startListening()

        elif command == "exit": # option to exit the listener function and return back to the main terminal loop below
            return 0

        # repeating input

        return self.useListener() # recursion allowing the user to keep giving inputs to the LISTENER terminal if they so choose to

    def startListening(self): # start listening function that you can potentially use when starting the listener

        # Starting Socket Server
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        # Binding Server
        s.bind((self.options["LHOST"], self.options["LPORT"]))
#

there is a bigger snippet

mortal flint
#

if the error is on the s.bind() line, do a print() just before it, of the two things you're passing in.

#

what is the contents? (or use a debugger/IDE, if you know how)

lilac holly
#

contents?

#

user inputs lhost and lport

mortal flint
#

contents of the things you are passing in- LHOST and LPORT

lilac holly
#

set lhost 127.0.0.1
set lport 1234

#

thats it

mortal flint
#

the error is on the s.bind() line, yes?

lilac holly
#

mhm

mortal flint
#

just before that line, do:
print(self.options["LHOST"])

#

and same for lport

lilac holly
#
K1B0R:> use listener
K1B0R(Listener):> set lhost 127.0.0.1
LHOST -> 127.0.0.1
K1B0R(Listener):> set lport 1234
LPORT -> 1234
K1B0R(Listener):> run
127.0.0.1
1234
#

ok

#

but no listener

#

error is :

#

TypeError: an integer is required (got type str)

mortal flint
#

okay. So look carefully are the two values you passed in

#

do they both look like integers?

lilac holly
#

yeah?

mortal flint
#

well, the second one is. But we can rule out that being the problem by passing it in as int(self.options["LPORT"])

#

but look at the first one, the IP

#

that's not an int

lilac holly
#

ok can you just gimme the fix for the line then or do you just not know how because if thats it thats oki broskie πŸ˜‚

#

'```python
s.bind((self.options["LHOST"], self.options["LPORT"]))

mortal flint
#

go find what the s.bind() method actually wants as input

#

but anything with more than a single decimal point is not an integer πŸ™‚

lilac holly
#

i know do you know what is? πŸ™‚

mortal flint
#

a string πŸ™‚

lilac holly
#

not actually

mortal flint
#

which is what your typeerror is telling you- it sees a str

lilac holly
#

in certican cases it requires a ||tuple||

mortal flint
#

"it" being what?

lilac holly
#

the current line and what it requires to make the statement work or function propperly or work in general

mortal flint
#

you're being very vague

lilac holly
#
 s.bind(tuple(self.options["LHOST"])), (int(self.options["LPORT"]))
mortal flint
#

but if the s.bind() method wants a tuple, pass in a tuple. Look up the docs for the method

lilac holly
#
    s.bind(tuple(self.options["LHOST"])), (int(self.options["LPORT"]))
TypeError: AF_INET address must be a pair (host, port)
mortal flint
#

without knowing the method signature, I can't be of more help

#

I don't know what bind() wants as input

#

you gotta find that out, then convert your input to that format

jaunty void
#

but less of a pain?

lilac holly
#

Anyone ever have this problem with PyInstaller?

Command used :
pyinstaller --onefile --console test.py
Error when running test.exe:

Error loading Python DLL 'C:\Users\test\AppData\Local\Temp\_MEI24682\python38.dll'.
LoadLibrary: The specified module could not be found.
#

Question: an executable program or object code would be like Facebook the application itself correct? What the user is interacting with? Technically the rolled out end product?

magic falcon
#

Can you refine your question a bit? It's not clear what you are asking.

lilac holly
#

I think I found my answer now 😊

tepid cargo
#

(yes the art is mine kekw )

warped axle
#

Damn nice work on the profile picture

#

Wait

#

I think im looking at the wrong art

unique talon
#

Hey

#

I mest up my terminal

#

I was upgrading python

#

and now my terminal won't open even from vscode

#

I opened this

#

and I was wondering if I could get some help here

#

So...

#

please

#

I can't do anything terminal-related and my life is basically that

onyx merlin
unique talon
#

I can't thank you enough

onyx merlin
unique talon
#

yeah

#

now it opens normally

#

I undid the changes

onyx merlin
#

Great

warped axle
#

Oh wait nvm

desert monolith
#

!docs verify

narrow terraceBOT
desert monolith
#

sorted now

#

thanks

brazen eagle
#

Iirc that question was a weird one

wanton merlin
#

@surreal bronze can I dm you?

surreal bronze
untold blade
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

eternal abyss
#

would love if someone could help me figure this out

#

i'm a noob at programming

#

i'm trying to make a Caesar cipher decoder

#
# input a text to decipher
crypt = input("Enter your Caesar text to decipher: ")

# alphabet to decode from
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
            'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

# make a split function and split the text into separate characters
def split(text):
    return list(text)
chars = split(crypt)

# make list for indexing the characters into #'s and add them to the list
cryptIndexed = []
for letter in chars:
    cryptIndexed.append(alphabet.index(letter))

j = 0
while j in range(26):
    j += 1
    i = 0
    while i in range(len(cryptIndexed)):
        cryptIndexed[i] = cryptIndexed[i] + 1
        if cryptIndexed[i] == 27:
            cryptIndexed[i] = 0
        i += 1

    print(cryptIndexed)

    k = 0
    while k in range(len(cryptIndexed)):
        print(alphabet[cryptIndexed[k] - 1])
        k+=1
#

basically a caesar cipher is the alphabet is shifted x amount of times

#

so ABCD could be BCDE etc

#

im trying to print all 26 possible iterations

#

it works but when a letter gets to 'z' it will print z twice instead of going back to 'a' with the way i have it set up. -1 == 26 basically so that's why it prints 'z' twice

#

i have tried a lot of things but can't figure out how to make it work. would appreciate any help 😁

#

this is in python btw

pseudo mist
#

maybe you should make it a circular loop

#

using % operator

eternal abyss
pseudo mist
#

ow.hey

#

i got it

#

if cryptIndexed[i] == 27:
cryptIndexed[i] = 0
i += 1

#

reverse this

#

i += 1
if cryptIndexed[i] == 27:
cryptIndexed[i] = 0

#

to this

#

it should work

pseudo mist
#

increment this 1st and then chwck the condition

eternal abyss
pseudo mist
#

ow

#

oh

#

that was bad

#

even if we add try and except???

#

am not sure it will work

eternal abyss
#

hmm

#

yea i don't think that's right

eternal abyss
#

i'm just not sure how to do it

pseudo mist
#

yes. but I never tried it on python

#

and not sure about that

#

i mean how to do that

#

just check out circular loop or somthing

eternal abyss
#

ok i give up for now lol

#

time to slep

pseudo mist
#

good night

eternal abyss
brazen eagle
#

Theres a lot of optimization that can be done here, I also suggest writing tests to verify your code

#

I'd also use modulo arthmetic to get your index

magic falcon
#

I agree with Hydra. It's also a much more common operation to use modulos on the index to overflow, than to use a stored value from the array. When I end up doing textual manipulations similar to this , it's almost always worth it for me to use the unicode or ascii value of the symbol. that conversion is well known and usually faster than repeating a search over and over to get an index from data definition structure.

proper void
#

i have a simple question,suppose we are creating an array or vector in a language like C++,are the values that we give to it stored or allocated in RAM?

remote echo
#

Array gets allocated on stack, as the size is fixed and can be determined at compile time.
Whereas, vector gets allocated on heap, because it's ability to grow/shrink comes from dynamic memory allocation.
On RAM? Yes, everything has to be on RAM, RAM isn't appropriate term for this question ig.
plz correct me if wrong

wispy kestrelBOT
#

Gave +1 Rep to @remote echo

brazen eagle
remote echo
#

We can, but we have to manually do that

#

C++ won't do it for us

#

vectors are technically arrays though

brazen eagle
#

Well yes

lilac holly
#

Yo guys, if I am manually making a picture with the bmp file format, the colors being only 1 bit deep pixel size 32x32, that means the file size should be 8 right?

#

Considering (32/8) Γ—2

#

Or do I need to add the header size on to this

#

Which I am guessing

dusty ore
#

Hey guys, can I ask how this is encoded?

#

Nguy\elec5n means Nguyα»…n

solar hull
brazen eagle
brazen eagle
wispy kestrelBOT
#

Gave +1 Rep to @solar hull

solar hull
brazen eagle
cedar furnace
#

will this code work?

tiny meteor
#

It's been 30 min. To get a reply instead u can just run the code and try if it's working or not

cedar furnace
#

Doesn’t work

#

I already did that

#

@tiny meteor

remote echo
#

Did u looked how read works?

#

It only need the variable to put the data into.
If you want to show that prompt of "Please enter ... " You have to use -p

#

just Google read in bash and all that comes up u know

stone kayak
cedar furnace
#

I found out how it works

#

now my script is working

tulip sail
stone kayak
#

im sure they care a lot

tulip sail
#

A binary choice between Go or Rust might have been less work for you

stone kayak
#

"would you like the ice cream made in Manchester, or the ice cream made in Whitby?"

#

"I don't care give me ice cream" - Every user

stone kayak
#

Also the question is supposed to be "should i switch away from python?"

remote echo
true pumice
tulip sail
#

@lilac holly would you stop posting commands designed to crash people smh

#

!rule 17

narrow terraceBOT
#

Rule 17: Do not intentionally mislead others with malicious intent, especially should this misleading end up in destruction of property or otherwise damaging. Things like rickrolling are still allowed, just don't lead someone to damaging their computer/system.

lilac holly
#

but this will not crash lol i was workin on a project at that time i encountered that terminal wont print anything but is fully functional

tulip sail
#

You mean it won't cause the terminal session to fill up with a ludicrously big number and die until it's finished..?

lilac holly
#

u can try it on VM if u want to make sure, BTW i am doing it on Windows 10

tulip sail
#

-undelete -a

lilac holly
#

ummmm..?

tulip sail
#

Okay, well, at least Python handles it Okay *sigh*

#

Still not hugely helpful, but I'll grant you that it's not malicious

lilac holly
#

also my phone was printing that without any crash or freeze am still thinking whats wrong with my lappy 😫

proper void
#

i was solving the xxe lab on portswigger's web security academy,here's what i don't understand: how would i know what is the xml input here which needs to be altered for our benefit?

brazen eagle
#

Probably by intercepting requests

pine barn
#

I was doing the ninja skills room with bash scripting

#

Is there some way to use a file as inputs for a .sh script?

#

In the script i do
read var
is there some way to assign var pre executing with ./script ?

#

Printf input | ./script resolves my problem

hushed kernel
#

Guys i have coded a program like dirbuster in python, Is there a way to install and launch without Path

#

For example when i'm launch dirbuster i Just write dirbuster

pine barn
#

I think you should add the path of the script to the $PATH variable

hushed kernel
#

@pine barn Cool, thank u man

wispy kestrelBOT
#

Gave +1 Rep to @pine barn

true pumice
#

Run it from it's direct path?

pine barn
#

Or move the script to /usr/bin

true pumice
#

^

pine barn
stone kayak
hushed kernel
glossy iron
#

Heads up developers. Tomorrow I will be posting the development roles available at my organisation in #jobs-board . These include some React, C# / .Net things, so if you're interested keep an eye out tomorrow PM UK time πŸ™‚ .

brazen eagle
pine barn
brazen eagle
#

Symbolic link

#

It's kind of like a shortcut in windows

#

Look up the ln command with the -s option

rugged juniper
#
function greaterThan(n) {
    return m => m>n
}
let greaterThan10 = greaterThan(10);
console.log(greaterThan10(11));
#

help me understand how the second line works

solar hull
#

The let line assigns to greaterThan10 a reference to a function that returns true if its parameter is larger than 10

#

The second line return m => m>n uses a lambda construct.

rugged juniper
#

so if we dont assign a name to the function then it acts as a parameter to the original function?

tepid cargo
# rugged juniper ```javascript function greaterThan(n) { return m => m>n } let greaterThan10 ...

you can rewrite it like this if it helps u understand:

function greaterThan(n) {
    return function(m) { return m>n }
}

now when u run greaterThan(10) because of JS closure u get a function retutned something along the lines of this:

let greaterThan10 = function(m){ 
  return m>10 #(from the closure) 
}

the first function is called second order function. Closure is awesome, i suggest u read it a little.

broken shuttle
#

My friend describes Rust as C programming done properly, how accurate is this and why ?

solar hull
#

The goals of the languages are similar, but the approach on how it is done is completely different. C pretty much allows the developer to do anything, Rust requires you to jump through hoops to do anything that the language developers have considered a stupid thing to do.

hushed kernel
#

Guys i want sharpen my python skill, do you have some ideas for tool i can create? Maybe no too complex

#

I have already created a dirbust like tool

mortal flint
#

Check the pins, I think there was an image that had a bunch of ideas

brazen eagle
#

Or implement ICMP echo/echo-reply from scratch

hushed kernel
brazen eagle
#

Bonus objective, use command-line arguments properly and add a help function

#

Also use classes

#

Bonus bonus objective, add a progress indicator and multithreading

warped axle
#

Thats a lot of bonuses

solar hull
#

multithreading or asynch?

clear needle
hushed kernel
wispy kestrelBOT
#

Gave +1 Rep to @clear needle

brazen eagle
#

Just the async manages the thread pool for you

magic falcon
#

IIRC async manages context switching in a different way - more event based and less reliant on the process scheduler

plain path
#

I need to run a script with python, not python3. theres a module missing but when I try to install it with pip, it says its already installed @ the latest version, but obviously for python3 not python

#

how do I tackle this

#

its CVE-2019-9053 SQLi injection

true pumice
#

Sounds like you need python 2

#

First, install python2.
Then, run: curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
Finally, type python2 get-pip.py

plain path
#

throws the same error when running with python2

true pumice
#

After that, you will need to use python2 -m pip <module name>

plain path
#

am I being an idiot or what

#

lmfao

true pumice
#

Read the error:)

plain path
#

yeah I thought it needs to be ran in python2

#

still lost

#

pepehands

#

I installed pip 2.7 to try to get the module (termcolor) through there and no luck

true pumice
#

Hmm, did you use python2 -m pip <module name> to install termcolor?

plain path
onyx merlin
true pumice
#

I knew it looked incorrect, sorry πŸ˜„

plain path
#

so im running the lower pip version with python2 to run the script, and I still cant get the module, im guessing because its completely stopped being maintained?

#

I have both pip versions

#

the latest one and the one in the warning

#

they arent compatible

#

are older scripts always this much pain in the ass to get to run? or is it just because I dont have enough experience with hunting down dependencies / missing modules

onyx merlin
#

You can edit the script to remove the dependency, just work out which functions it is

#

It's just used to print output with colours, it's not important for the functionality

#

Can be replaced with print()

plain path
#

Yeah I thought about that, but looking for a more sustainable solutions to when this happens. Cuz other scripts I also have problems with missing modules sometimes, and more often than not its something imperative to the function of the script thats missing so I cant just take it out. hence why I would like to learn how to solve these issues without altering the script and instead installing the dependencies successfully

#

pip is for python and pip3 is for python3, so how come this happens

magic falcon
#

Sometimes that is not possible.

plain path
onyx merlin
magic falcon
#

Dependencies can change; this is one of the reasons that I don't install any python libs outside of a venv.

onyx merlin
plain path
#

aaah

onyx merlin
#

python2 -m pip

plain path
onyx merlin
#

So you can't install the module unless you fix that error. So you got a choice.
Fix the error, or remove the dependency.

magic falcon
#

Installing a lot of modules outside of a virtual environment can sometimes cause conflicting dependencies. Troubleshooting that is like digging through a burning dumpster.

plain path
brazen eagle
#

Should learn to use venvs properly one of these years

magic falcon
#

When I am working on something that needs 3rd party modules, such as from pypi, I always create a virtual environment to run them in.

#

Same with writing any python scripts or programs. Virtual Environments have saved me days of troubleshooting when different things I'm working on require incompatible versions of libraries.

plain path
#

I dont have enough experience with dealing with dependencies, yet. Do you mean when two things require the same library but a different version of it?

stone kayak
#

🧠

magic falcon
# plain path I dont have enough experience with dealing with dependencies, yet. Do you mean w...

A dependency is an external item required for something to run correctly. This could be source code libraries, modules, or other files. Each individual dependency (e.g., termcolor) may have it's own set of dependencies; and so on. You may hear this sometimes called the 'dependency tree'. Sometimes, a dependency on one branch will require version Xd of module X, and a different dependency, sometimes not even related to the first dependency, requires version Xe of module X. Since both versions are required by different parts of the main program, this is the conflict.

plain path
#

aaah right

#

so theres no way to get them to work at the same time out of the box

magic falcon
#

It's more common than one would think, because modules are all maintained by different groups. Installing enough modules, and the likelihood of a conflict becomes almost a surety; usage of virtual environments restricts the number of modules that are reachable by the project and decreases the likelihood of a conflict.

plain path
#

because using VMs you can always wipe it easily and install whatever is required in that moment?

magic falcon
#

a virtual environment is not a VM

#

a VM is an entire OS in a sandbox

#

the virtual environment is a set of python scripts that basically pre-pend to the PATH system variable to ensure the virtual environment is the first place the python interpreter looks when trying to resolve dependencies and resources.

plain path
#

this has been very helpful though i dont understand it 100%. really appreciate it

plain path
magic falcon
#

Syntax is a big clue; prior to Jan 2020, python was assumed to be py2. You can use the publish date to infer which version of python it is

plain path
#

got familiar with virtualenv and its starting to make a lot more sense ^^

#

so does the word "python" refer to the latest version by default?

true pumice
#

It should point to python3

plain path
#

right

true pumice
#

Unless you don’t have python3 installed

plain path
#

how do I set the defaults for python and pip

magic falcon
#

Jabba is right. Prior to Jan 2020, /etc/alternatives/python was usually a symlink to py2. Now, it's a link to py3.

brazen eagle
#

Of a script anyways

plain path
#

I see

magic falcon
#

It has do with a fundamental change in py3 from py2. In py2, print wasn't a function call. In py3, it is.

plain path
#

right its a built in function

#

idk squat about py2

brazen eagle
#

/shrug Or you can try running it in py3 and see what breaks

plain path
#

I solved it with sudo update-alternatives --config python

#

on a somewhat unrelated topic but still python...how does python sustain itself? I understand its a programming language anyone can use, but like...how does it sustain itself? the people developing & pushing out new versions, where do they get the money to keep doing what they are doing? I mean so much depends on python it is no joke, but its open source, right?

#

is it just people passionate enough to contribute without compensation?

#

the whole economics behind programming languages seem a little disconnected from todays cutthroat capitalism

#

the lads who invented C should be billionares if it made any sense

#

major programming languages gotta have people working on it full time, right?

stark lance
# plain path on a somewhat unrelated topic but still python...how does python sustain itself?...

i'd assume some projects get donations, An while being someone who's fairly well with coding could an may lead you to many job opportunity's. With opensource projects it's a collaboration thing consisting of the public at times for help if not most times. So it's not like ten people constantly working day an night (you may have the few who do it full time) so it's easier for people too live a normal life

stone kayak
onyx merlin
#

Good code will say either python2 or python3 explicitly

shy forge
#

Actually, python to me is like a /root to me. Others are just /tmp

plain path
#

technologically speaking, I mean

#

not pushed forward as in marketing or w/e

magic falcon
#

A lot of big open source projects are funded that way.

stone kayak
magic falcon
#

Typically there is a foundation that is funded by corporate interests and user donations. Apache is a great example of that.

stone kayak
plain path
#

and other corps can then leverage those features that google etc. paid for?

stone kayak
#

All the python foundation donors

stone kayak
plain path
#

right, thats what im asking. doesnt seem like the most competitive practice

magic falcon
#

Other times, the 'upstream' FOSS project is a publicly-available version of the more stable corporate version.

plain path
#

FOSS?

magic falcon
#

This second model is what companies like Red Hat and SuSE use for their products.

#

Free Open Source Software

plain path
#

ah

stone kayak
#

Some projects also have corporate hosted versions like elastic search

magic falcon
#

It can be a pretty complex ecosystem

stone kayak
#

Mark Zuckerbergs charity is a corporate sponsor of python haha cute

magic falcon
#

Rancher, Google, AWS and Red Hat all their own flavors of kubernetes, as another example. The differences between EKS and vanilla k8s are pretty minimal, but something like OpenShift has a lot more involved to set up.

plain path
#

interesting

solar hull
plain path
warped axle
tulip sail
solar hull
#

...or Apple

lilac holly
steel vigil
#

Ola, can someone help me understand what is offsets in assembly? (I know about segments, but I can’t get the idea of offsets)

stone kayak
#

Does CyberChef have Normalised Entropy? Specifically Shannon Scale Entropy divided by the information length?

I can't find normalised, wondering if there's some cool macro or something for it? πŸ€”

brazen eagle
#

Sounds like a PR

dusty ore
#

Hi guys

#

I'm new to bash programming

#

May I ask what this code does? I mean, when I run it, nothing happens

#

FILELIST=`ls` FileWithTimeStamp=/tmp/my-dir/file_$(/bin/date +%Y-%m-%d).txt

#

oh ye im stupid, it just initialize a variable

warped axle
#

Yes u are stupid

#

Jk

dusty ore
#

I'll take that

#

Its fine

warped axle
dusty ore
#

I'm learning bash but I dont understand what this means. Can somebody help me?

#

Nah nvm I got it

#

Thanks

stone kayak
#

Hi! I want to do something like this in Rust:

/
- struct.rs
- obj1.rs
- obj2.rs

Where obj1 and obj2 both impl (implement) functions onto the struct struct.rs, but are separate.

Basically, struct.rs is a parent class and I'd like to create children classes from it.

I don't think it's possible, but would like to double check πŸ˜„

#

I think the way Rust wants me to do this is to have structs for every object, but say they all use the same interface(s) (traits in Rust).

This is annoying because I'd copy and paste the same struct over & over again, I might have to use Rust Macros https://doc.rust-lang.org/book/ch19-06-macros.html to fix that but I'd rather see if "parent structs" are a thing 🀷

solar hull
#

Is the problem with the function declarations, or that you'd have to duplicate the implementing code?

thick horizon
#

C

#

is a very good and fast language actually.

#

I recommend it.

#

I used javascript before.

stone kayak
#

duplicate code!

warped axle
#

What if u wrote code that will duplicate the code for uπŸ‘€ πŸ‘€

solar hull
#

Doesn't sound too tempting or maintainable. But some kind of delegating or just splitting part of the functionality to another object might do.

warped axle
#

Or he could create such funtionality and make a PRdarkchamp

#

Wait i dont think rust is open source is it?

onyx merlin
solar hull
#

I think that's against the design philosophy of the language.

stone kayak
stone kayak
# warped axle What if u wrote code that will duplicate the code for uπŸ‘€ πŸ‘€

https://doc.rust-lang.org/book/ch19-06-macros.html#:~:text=The term macro refers to,three kinds of procedural macros%3A&text=Attribute-like macros that define,tokens specified as their argument

In Rust there are macros you already use.

println!("Hello, World!")

println! is a macro, this is code that will duplicate what is inside the macro into where it was called.

Think of it like a templating language, in the macro you have variables and the inputs you give to the macro ("Hello, World!") gets templated in πŸ™‚

#

For example, in RustScan I have a macro that handles:

  • Pretty printing with colours and stuff
  • Printing for A11Y purposes.

So instead of doing:

if A11Y = True:
  print_accessible(x,y,z)

I have a macro that does that for me πŸ™‚

#

The idea of having code that expands into more code is kinda weird, and can be abused to be horrible but! it is a good idea for smaller things πŸ˜„

warped axle
fading tartan
#

hey, I'm trying to create a regex that selects all the fifth comma in a line but cant get it to work. Can someone help rlly quick?

dusty ore
fading tartan
#

hello,hello,hello,hello,hkf,jjl

warped axle
#

Pretty sure he meant code

fading tartan
#

here is want to select the 5th comma only using regex

#

I dont have code

dusty ore
#

So the expected result is , right?

fading tartan
#

Yea

dusty ore
#

or everything after the fifth comma

fading tartan
#

I just want to select the fifth comma only

dusty ore
#

Hmm

warped axle
#

What regex engine are you using?

#

The solution can vary based on your regex engine

fading tartan
#

I just use sublime regex, I'm modifying a data set

#

.* could that be it? I almost never use regex lol

warped axle
#

That is a wild card?

#

And by regex engine i mean like what programming lang?

fading tartan
#

No programming lang

#

I just use it to filter out specific data parts

warped axle
#

But...

fading tartan
#

its implemented as a search function

warped axle
#

What is out putting the result then

#

Like whats showing u if it workes or not

fading tartan
#

the selector selects all selected items filtered by the regex

#

for example

#

[,]

warped axle
#

Ohh

fading tartan
#

that selects all ","'s

warped axle
#

Wait

#

I get it now

#

Sorry had a brain fart

fading tartan
#

Hahah no worries

#

and this: [,]$ selects the last comma of each line

#

but i need the fifth one only

warped axle
#

I think replacing the $ with a . Will workish..?

fading tartan
#

this gets back every , and text after it

#

why is regex so hard πŸ˜‚

warped axle
#

Where on earth do u select find by regex im sublime

#

Wait got it

fading tartan
#

cool πŸ™‚

warped axle
#

right so this should work with the text that your provided [,]\<

fading tartan
#

for me it selects the first comma and the second one

dusty ore
#

try (?=(,[^,]{0,}){1}\n),

#

I googled it cuz im stupid but it should work

#

@fading tartan

fading tartan
#

this only selects the last one for me

warped axle
#

regex is pain

#

what text are you trying this on?

#

snippet?

fading tartan
#

I have multiple lines (multiselect is on)

#

like:

#

hello,hello,hello,hello,hkf,jjl
hello,hello,hello,hello,hkf,jjl
hello,hello,hello,hello,hkf,jjl

#

this format pretty much

#

hello,hello,hello,hello,hkf (THIS ONE IS NEEDED )> , jjl

warped axle
fading tartan
#

^([^,],[^,]),

dusty ore
#

Nah it doesn't work

fading tartan
#

this one selects the second one and everything before it

dusty ore
#

I dont know much about regex so I guess I can't help you Redux

fading tartan
#

No problem thanks for helping πŸ™‚

dusty ore
#

goodluck

warped axle
#

wait ok let me get this straight here

#

with this text you want to select every comma yes ?hello,hello,hello,hello,hkf,jjl

#

or just the last one?

fading tartan
#

no

#

only the fifth one

#

not the last (in this case its the last but specific the fifth one)

#

every comma is [,]