#programming

1 messages · Page 17 of 1

tulip sail
#

Always check the pins 😛

red canopy
#

oh, thanks!

tulip sail
#

Np 🙂

red canopy
#

anybody wanna help

#

Its python

#

nvm

#

I reprogrammed it

#
import re

n, m = map(int, input().split())
a, b = [], ""
for _ in range(n):
    a.append(input())

for z in zip(*a):
    b += "".join(z)

print(re.sub(r"(?<=\w)([^\w]+)(?=\w)", " ", b))```
obtuse matrix
#

anybody i'm having problem with the python pip

tulip ibex
#

yes

obtuse matrix
#

i've just installed the module, but when i run it, the interpreter can't find that module

tulip ibex
#

linux? or win

obtuse matrix
#

win 10 dude

#

are it's PATH variables problem? or any else?

tulip ibex
#

which module/

obtuse matrix
#

most of my installed module

tulip ibex
#

i never had a problem

obtuse matrix
#

maybe some PATH variables aren't exist in the settings i guess

#

cuz when i'm debugging via VSC python debugger, it runs

#

ex : i've installed selenium

#

when running on cmd, that

ModuleNotFoundError: No module named 'selenium'

appears

tulip ibex
#

try pip3 or pip

#

or both

#

and try

crude chasm
#

Noticed today that pip3 search is removed 😢 sadface

obtuse matrix
#

still having that problem

cursive charm
obtuse matrix
obtuse matrix
brazen eagle
#

that's pretty hilarious

rigid tapir
#

can anyone help me make something better on memory in python than this? maybe fetch text file and next index number every time rather than caching the whole file?
it just crashes for me as i'm trying to compare rockyou.txt to something
||python -c '
lines_to_remove = set()
with open("file B", "r") as f:
for line in f.readlines():
lines_to_remove.add(line.strip())

with open("file A", "r") as f:
for line in [line.strip() for line in f.readlines()]:
if line not in lines_to_remove:
print(line)
'||

subtle coyote
#

What do you mean you’re trying to compare rockyou with something?

rigid tapir
#

remove lines that appear in rockyou.txt from easyctf.txt

subtle coyote
#

any particular reason you wanna do it with python?

#

Instead of bash?

rigid tapir
#

awk 'NR==FNR{a[$0];next}!($0 in a)' <File1> <File2>

crashes in bash too.. granted my vm only has 4gb memory, tried loads of different ways using comm and diff, nothing works properly

#

So I imagined in Python there must be a way to make it more memory efficient by grabbing a line number each time instead of sticking the whole file in memory

subtle coyote
#

You can but I’m on my phone so I can’t type it out rn

#

That’s an easy way to do it with bash^

rigid tapir
#

the one starting with remove-lines() ?

#

I must've missed that one

magic falcon
#

That operation can't really be made 'more memory efficient'. You could divide up the file into chunks and process each chunk - but then additional loads my be needed to ensure all keys processed.

subtle coyote
rigid tapir
#

I can't understand how it crashes if the files are 133.4MiB / 38.5 KiB . Unless it's being very inefficient. I will try a per line version

subtle coyote
#

You don’t have to load more than 1 line into memory at a time

#

If you look at that last link

rigid tapir
#

I promise I will fully learn python in the future but for now it's a copy/paste! food now so brb but thanks!

subtle coyote
#

@rigid tapir type it out instead of copy paste

#

It’s weird but I promise it helps you learn

rigid tapir
#

||lines_to_remove = set()
lines_we_want = set()
with open("/Labs/easyctf/rockyou.txt", "r") as f:
for line in f:
lines_to_remove.add(line.strip())

with open("/Labs/easyctf/new.txt", "r") as f:
for line in f:
lines_we_want.add(line.strip())

for line in lines_we_want:
if line not in lines_to_remove:
print(line)||

subtle coyote
#

🥳

sly shuttle
#

Anyone here good with sed or awk? I've google'd my ___ off and can't figure out this problem.

subtle coyote
#

What’s up

sly shuttle
# subtle coyote What’s up

I'm trying to parse a .nmap with my script. I want to grab a section of output related only to a single port. Getting the start point is easy, but it keeps printing after the section, even if I give it regex to stop.

sed -e '/^$port/tcp/,/^([0-9]{1,5})/tcp/p' target.nmap

What I want it to do is stop printing when it gets to the first occurrance of the regex.

subtle coyote
#

Find an end character to split on and grab the stuff before that

magic falcon
#

I usually grab the .gnmap file for that kind of post processing.

spiral glen
#

Hello
So i m trying to make a password guesser which has 10 digits
this is my code

function generateCode() {
 var code = "";
 var chars = "0123456789";
 for (var i = 0; i < 19; i++)
   code += chars.charAt(Math.floor(Math.random() * chars.length));
 return code;
}
function main() {  
   document.getElementById("redeem_code_token").value = generateCode();
   document.getElementById("redeem_code_submit").click();
}```

setInterval(function() {
   main();
}, speed);
so wat i want to know is..
When the computer gets the pass the computer clicks enter
and keeps on doing tat
but i was wondering tat the computer does not click enter but gets the pass coreect
#

so the computer does the guessing on another server when it gets the real pass it will tell us the pass

#

do u guys get me

#

??

#

i m really new to the hacking and all btw

tepid cargo
#

oh this is js

#

let me take a look 😛

#

can u check pins on how to make codeblock?

spiral glen
#

?

tepid cargo
#

wut the heck

spiral glen
#

what??

tepid cargo
#

check the pinned msg. by muiri on how to make code blocks in discord

spiral glen
#

ok

tepid cargo
#

oh so u want to generate a password that would be fed into the inputbox and will be clicked enter. if it works ur js script should stop?

spiral glen
#

no
so the compter randomizers number a clicks enter to see if its coorect

#

but i want the computer to not click enter i want it to guess the number.but not click enter. but the computer should still know if its correct or wrong

#

example

#

when u try to figure out a pass of the iphone and keep on trying the iphone will lock right

#

but this time it should not lock but the computer should still know if the pass is correct or wrong

#

Do you get me

#

?

tepid cargo
#

oh that will be dependant upon what is the code that Checks the password is.
if it's an xhr/ajax u have do the xhr request in order for you to know. this will probably lock u out after some tires.
if it's client side code u can just run that client side code.

the best way would be somehow to get the encrypted password or hash from that application and cracking it on ur machine.

#

so yeah. without calling the validating function no matter what the form, it's impossible to know

spiral glen
#

so is it possible or not

tepid cargo
#

as i said. depends on the validation code that u got.

#

it might be impossible it might be possible.

spiral glen
#

ok

#

thks for the help @tepid cargo

spiral glen
tepid cargo
#

there is no easiest way. password cracking takes a lot of research. rule of thumb, dictionary attacks are your best bet.

#

cause bruteforcing takes like forever to complete

spiral glen
#

lemma do some reaserch on thumb dictionary attacks

#

thks

#

is the attack called thumb dictionary

#

i googled it and no results

tepid cargo
#

no no. "dictionary attack" is the attack name.

#

i said "rule of thumb" sorry for the absense of punctuation marks.

spiral glen
#

ok

#

what should i google

#

i m getting no results

tepid cargo
#

what do u mean.. just google "password cracking dictionary attacks" or somehting along the lines.

thorn moon
# spiral glen but i want the computer to not click enter i want it to guess the number.but not...

The situation you're asking about is what you'd do once you have the stored hash of a password. With the password hash, you can brute force it by hashing as many passwords as possible until you find a match with the hash. However, without the saved password hash, you have to go through whatever login system there is. And the reason systems make you wait longer after each failed attempt (or lock you out completely) is specifically to prevent exactly what you're trying to do 🙂

true pumice
#

@spiral glen What are you trying to use it for?

spiral glen
true pumice
#

For what

spiral glen
#

just experimenting

#

i m a begginer

true pumice
#

What are you testing it on though

spiral glen
thorn moon
#

I think what they're asking is, what are you trying to crack the password of?

true pumice
#

You can't know if it works if you don''t test it

true pumice
#

What file

spiral glen
#

computer

#

y r u making me a SUS

true pumice
#

If you have nothing to hide, you should easily be able to answer my questions.

spiral glen
#

i have nothing to hide

#

i told u

true pumice
#

So you're trying to brute force your own computer password?

spiral glen
#

mmm

#

yea

true pumice
#

And how does that work?

spiral glen
#

i gotta go.

#

bye

tepid cargo
#

that was a quick noping out kekw

spiral glen
verbal wharf
sage oxide
#

Can someone suggested me a final year project ?

long dawn
#

about web, android..?

sage oxide
#

A cross platform application that could run on both.

#

On desktop and on cell phone.

tepid cargo
#

u can make a react native app for mobile and use a electron container for desktop.

#

can make common components which can be used in both.

#

tho rn components are different. 🤣

dry bluff
#

i made a backdoor via c which is copied from a udemy lecture.In lecture that backdoor work properly but in my case it doesn't working .
value of the port was 50005 and the os is pop os
target os is windows 10(ipv4)

onyx merlin
#

Firewall.

dry bluff
#

but cannot get back the connection

#

one more thing backdoor's port was 50005 and listener port was 50004
but i changed the port 444/4444/404
and i uploaded the exe in github and downloaded it from windows

onyx merlin
#

Defender?

dry bluff
#

i checked my code again and again i didn't find any bug

tepid cargo
#

so can u like debug it? like putting printfs here and there? that way u can pinpoint what is happening.

dry bluff
dry bluff
tepid cargo
dry bluff
#

can i share the code?

tepid cargo
#

so you copy pasted the code, so that should make sure the code is correct (if the source is not wrong). then pasting the code will have no meaning.

dry bluff
#

the code is correct i just only copied this code for fun and check out how backdoor really work i only know c programming language so that i just tried it and i want to add some features in this code
but the base code is not working for me that's why i need some help

onyx merlin
#

How do you know the code is correct if it isn't working?

#

And how do you expect us to help if we can't see the code?

tepid cargo
#

lol. i mean why can't u add some printfs to pinpoint WHERE the problem is

#

😐

dry bluff
tepid cargo
#

that's like step1 of any troubleshooting if u don't have unit testcases.

dry bluff
onyx merlin
tepid cargo
dry bluff
dry bluff
true pumice
#

Can you send the code here please?

dry bluff
#

i uploaded it github

dry bluff
dry bluff
#

@tepid cargo bro what is the problem any idea

tepid cargo
#

sorry. it's a good amount of code and really don't have that kind of time right now to review. 🙂 But I mean u should follow basic debugging steps. like maybe comment out some part that is not necessary right now and put logs. then add some lines back. do it like this.

dry bluff
#

the bug //sock=socket(AF_INET,SOCK_STREAM, 0);//

#

it is the imposter

tepid cargo
#

why

#

?

#

cause syntactically it's correct. AF_INET == ipv4 and sock_stream== tcp and 3rd param i don't know 🤣 just know that all that time it is set as mostly 0

dry bluff
tepid cargo
#

u changed the server_address.sin_addr.s_addr right?

dry bluff
#

it is for ip address

tepid cargo
#

yeah exactly 🤣 it shouldn't be "MY IP :)"

tepid cargo
#

i don't know how this code works, if the server binds to another socket or something. depending upon that it should be either localhost or the socket ip or ur ip.

dry bluff
#

but its work it is from google

tepid cargo
#

server.sin_addr.s_addr = inet_addr("xxx.xxx.xx.xxx"); u can see the ip being put here.

#

and please check pinned msg on how to create code blocks

#

if it's reverse shell then it should connect to ur IP. if it's bind shell it should connect to localhost.

#

so if u understood from udemy u can change it depending on what the program is doing.

#

I would suggest to maybe understand what the program is doing?

dry bluff
#

bro please delete this messege

tepid cargo
#

?

onyx merlin
tepid cargo
#

cause it had their class C ip 😐

#

so i also don't know why

onyx merlin
#

private IPs facepalm

lilac holly
#

Just try to make it from scratch

#

More fun that way and you learn more

#

No point in copying code

tepid cargo
#

i mean, honestly doing something from scratch is waste of time if you know how things work already. kekw I would never do it.

lilac holly
#

Of course but does it look he does? If you're a beginner then it's not a waste but in ur case it would be

haughty shadow
#

Hi like to ask a question about tryhackme dashboard implementation, does the number of points scored in our weekly trend graph, read from a eventual consistent table table.?

tepid cargo
#

eh

#

no idea

lilac holly
#

is it possiable to create your own firewall, so that way you don't have to buy one darkchamp

tepid cargo
#

there are open source ones though. is snort a firewall? that's free lol

lilac holly
magic falcon
#

snort is an IDS, not really the same thing

tepid cargo
#

yeah yeah exactly. intrusion detection system

#

i forgot the term completely 🤣

#

thanks juun ❤️

magic falcon
#

yw

#

It's definitely possible to build your own firewall - pfsense is a good choice.

lilac holly
#

blobfingerguns only thing is I have no clue how to do any of this darkchamp

magic falcon
#

I personally run a Ubiquity DMP, it's very accessible for a prosumer firewall. The price was significantly less than buying new hardware + spending time configuring

lilac holly
#

0.0

magic falcon
#

I have also had a fortigate 200E, the DMP is by far more friendly for people without a strong networking background

simple wadi
#

You can go back and do AOC from previous years if that interests you

devout root
#

all the competitive programming sites like leetcode etc?

tepid cargo
#

that's actually pretty nice

#

maybe nicer than leet code if u consider that 30$ per month paywall

devout root
#

kattis is lesser known but nice too, usually used by unis tho

tepid cargo
#

another one is codekata i guess

#

the ui is very cool

devout root
tepid cargo
#

c is subset of cpp right

#

u can use C syntax in CPP.. just put <c<headername>>

#

#include <cstdio>

#

don't remember the reason now but never written .h in cpp.

devout root
#

rust has a pretty steep learning curve

#

i think the std lib only has raw tcp/udp sockets? But there are a wide variety of excellent 3rd party libs though

tepid cargo
#

i went for golang.. and it worked out pretty great. there are awesome libraries as well as u can control nitty gritty details of ur program.

spiral glen
#

hey if somone gets one of my acc can i know what he is going with my acc

true pumice
#

Hm?

spiral glen
#

??

tepid cargo
#

@spiral glen sir. do i know u? why the friend request?

tepid cargo
spiral glen
#

can u answer me

tepid cargo
#

🙂

true pumice
#

@spiral glen

#

!rule 1

narrow terraceBOT
#

Rule 1: No unsolicited direct messages (DMs) to other members of the discord. This includes staff. Verify that the member you are messaging is ok with you sending them DMs. The only exception to this rule is if a situation warrants the involvement of a moderator in order to handle something such as harassment or a situation where another member of the discord has made you feel uncomfortable.

true pumice
#

Please respect the rules :)

spiral glen
#

oh sry

#

can u answer me

true pumice
#

You'll need to explain yourself

#

I have no clue what that means

spiral glen
#

So if someone gets my acc.
can i know what he will do with my acc

#

u get me

true pumice
#

Nope

spiral glen
#

like will he delete the acc

spiral glen
true pumice
#

You said "u get me"

#

And I replied with "Nope"

spiral glen
#

hmmmmmmmmmmm
k

tepid cargo
#

what account?

#

depends on the account right? there should be some kind of log.

spiral glen
#

spotify acc

tepid cargo
#

for example if they get ur netflix account u can check it in the viewing logs

tepid cargo
#

which u didn't play

spiral glen
#

i did not mean like tat

tepid cargo
#

then form a proper question?

spiral glen
#

if he gets my acc can i like give my acc a virus and destroy his computer

tepid cargo
#

that's a mod thing. @true pumice sir

true pumice
#

Uhh

#

That's called "Illegal" @spiral glen

spiral glen
#

is it

true pumice
#

As well as that

#

It's extremely hard to send someone a virus through spotify

spiral glen
#

cause wat if he hacked my acc and i wanted to do something back

true pumice
#

You don't

#

You call the local authorities

spiral glen
#

hmm

true pumice
#

Here take a read

spiral glen
#

ok

surreal bronze
#

how was the above conversation anything related to programming kekw

tepid cargo
#

this is absolutely awesome and pretty legit.

tepid cargo
#

anyone knows to skip a stage in gocd pipelines?

#

lets say i need to go to the 2nd stage of a pipeline but not running the first

#

i don't seem to find anything in the docs

magic falcon
#

clone the pipeline, comment out stages you don't want, run clone?

#

I did see that you can set a stage to manual mode, that you can trigger from webconsole. I don't know ifthat's anything like your intended behavior though.

tepid cargo
#

yeah i have made it manual

magic falcon
#

Hope that helps - I have more experience with tekton and jenkins than GOCD

tepid cargo
#

yeah yeah no worries. let me see if i can find anything.

lilac holly
#

DM me i can help you

rigid tapir
#

this is from AoC 2019.. day 6, quite happy with my code for the solution

#

||import requests
import json

path = ''
host = 'http://10.10.169.100:3000'
flag = ''
status_code = 200
json_response = ''

while(status_code == 200):
response = requests.get(host + '/' + path)
#print (response)
status_code = response.status_code
#print(status_code)
json_response = json.loads(response.text)
#print(json_response["value"])
#print(json_response["next"])
if json_response["value"] == 'end':
quit()
flag = flag + json_response["value"]
print(flag)
path = json_response["next"]||

#

but ofc it could be better i am new to python though

true pumice
#

Very cool for someone who's new to the language :)

rigid tapir
#

being used to powershell the flow makes sense but some things don't work as expected

#

like having the print(flag) on a line below the while loop, prints nothing

true pumice
#

You didn't break out of the loop

tulip ibex
#

@tulip sail ur nightmare

#

theres a accident outside my society

tulip sail
#

Oh?

tulip ibex
#

nightmares arnt over

tulip sail
#

They never are

tulip ibex
#

yesterday there was a accident..

#

today also

tulip sail
#

Oh. That's not good

tulip ibex
#

thanks for giving nightmare

tulip sail
#

You're welcome

tulip ibex
#

now just i have to be safe that i dont get out

lilac holly
#

Does any one know how to get access to someone’s email without the password

main kiln
#

O.o

iron haven
#

I mean

#

Social engineering could get you the password

#

But I would think you’d have to be pretty damn good

surreal bronze
vagrant zodiac
#

so i made this basic python script to output a a user u can echo to /etc/passwd.
anyone want to check what i can add or edit?
https://github.com/Ptotheo/PassWD

true pumice
#

This is cool

#

But what's the purpose

vagrant zodiac
#

if a user have write privleges to etc/passwd

#

you can make a new root user

#

thats atleast my idea

shadow vapor
#

Something like this?
echo "naughty:x:0:0:naughty:/root:/bin/bash" >> /etc/passwd

true pumice
#

Naughty it auto-hashes the password

shadow vapor
#

Add the hash instead of x.

true pumice
#

password = input("Insert Password:\n")

shadow vapor
#

Didn't check it

true pumice
#

print("chech what type of hash your distro is using:")

shadow vapor
#

On phone and travelling, my bad

true pumice
#

Pick your desired hash and do "cat *hash* > /etc/passwd"

#

@vagrant zodiac Why don't you allow the user to choose a hash and then it automatically puts it into the file for them?

vagrant zodiac
#

good idea!

#

on it

true pumice
#

:)

onyx merlin
pallid valley
#

Does any one know how to find the email addr of a steam account?

onyx merlin
#

@pallid valley why?

pallid valley
#

for gathering information ?

onyx merlin
#

What do you mean?

vagrant zodiac
onyx meadow
#

guys can i ask for help about programming

vague loom
#

Just ask your question

onyx meadow
fallen monolith
#

are you typig

" I am good "
#

exactly like that?

onyx meadow
#

no

#

I am good

fallen monolith
#

that's why

true pumice
onyx meadow
#

try I am good

#

it will ignore it

true pumice
#

Spooks is about to explain why

fallen monolith
#

normally, it'd be somethig like

if how_are_you == "I am good":
  print("good")
elif how_are_you == "Things are not good"
  print("Things will get better")
else:
  print("I didn't understand")
true pumice
#

It needs to match everything inside the speech marks

fallen monolith
#

^

onyx meadow
#

man I did it like this but somehow it didnt work

fallen monolith
#

it needs to be exact

true pumice
#

If you have a space before " Things

#

You need that space

onyx meadow
#

lemme picture it

true pumice
#

You need the space afterwards as well

fallen monolith
#

^

#

I personally would remove them from the if and elseif statement

fallen monolith
#

its clearly causing confusion lol

true pumice
#

You seem to add a lot of unnecessary spaces

#

Makes your code look really big

#
print()
print()
how_are_u = input ("Input: ")
print()

if how_are_u == "I am good":
    print("good")

elif how_are_u == "things are not good":
    print("Things well get better")

else:
    print("I didn't understand")
mystic nimbus
#

plus if you put the space in the wrong spot you will get errors

onyx meadow
#

ah ok it worked

#

ty

tiny violet
#

Hey google, help me get roles in here

#

Cuz i can't "DM" anybody, Google

true pumice
#

What?

tiny violet
#

answer = input('can I DM ?')
if answer == 'yes':
print('Ok come, you can clear your doubts !')
else
print('No, you can't ask doubts here !')

#

Output

rigid tapir
surreal bronze
rigid tapir
#

the AoC 2019 scripting challenges are fun! for a beginner haha

#

big rush when i printed 2 variables and managed to make there not be a space in between them...

thorny spear
#

hello everyone , please is there someone who knows how to programme in risc-v assembly ?

lilac holly
#

This file contains encrypted data encrypted using my password manager app. My password manger gets the 'website url', 'ligin id' and 'password' and stores in a JSON object variable. Each credentials are encrypted using aes256 ctr mode and again the whole JSON object is converted to string and encrypted using aes256 ctr. User will be asked to enter two digit secret number + Master password (to decrypt each encrypted credentials) + Database password ( to decrypt stringified JSON and parse it).

User has to store database file in their google drive or local pc and upload them when any credentials are needed use them.

#

two digit secret number (this number is used as counter in aes256 ctr mode)

#

I wan't to earn money online by building this password manger app. I want to make it trustworthy and hack proof.

#

Is the database_58.fpm secure? Is there anything to secure it.

crude slate
#

hey everyone

#

i have question

#

how can i by pass payload using apktool in kali linux

tiny violet
#

Maybe a click here will help

rigid tapir
#

does assembler stuff like cmp / jump comparisons always compare against eax?

#

here, I would expect it to be something like:
'Jump if var_4h is less than or equal to eax' which is true.
but it seems to be working the other way aound
'Jump if eax is less than or equal to var_4h'
which is false, and continues going to the next line

magic falcon
#

depends on architecture and syntax of that asm implementation- It's been a few years, but IIRC many asm syntax refs have compare and jump commands for literals, pointers, and registers

rigid tapir
#

yeah its just a bit confusing since its the exact opposite of how the mov command works

magic falcon
#

RISC is less likely to have that, pretty sure AT&T syntax and MIPS both support multiple typesp

#

Move commands also vary between different implementations - some are src, dst, others are dst, src

rigid tapir
#

yeah the AT&T is src,dst

#

but the compare statement is also flipped round so maybe i'm not understanding something

magic falcon
#

usually cmp sets a reference register for the next jump instruction. I'd have to go back to old notes for the breakdown of the ref register

#

i know there are other conditions you can set the conditional jump to, but i don't know them off hand

lilac holly
#

hello how are you guys

#

Good, I’m at school right now

lilac holly
#

Hi

true pumice
#

leg they're new I'm not massively changing their program lmao

tepid cargo
#

it is fun

tepid cargo
#

seems legit measurement unit kekw

lilac holly
#

Hi 🙋‍♂️

stone kayak
#

@tepid cargo i just met CS Dojo in a CP contest LMAO

tiny violet
#

Can we copy to clipboard using the linux terminal ??

verbal quail
tepid cargo
#

kekw that's dope

tiny violet
tiny violet
verbal quail
tiny violet
#

Nope

#

😄

tiny violet
verbal quail
#

ohh sorry I did not understand your question then @tiny violet

tiny violet
#

No u did

#

It's the same thing

#

Still looking for an inbuilt one cuz i gotta hash and sumbit the work

verbal quail
#

Do you mean like a python module?

stone kayak
#

?

tepid cargo
#

someone talk about npm packages as well pls

#

axios is a good one. i use it in most of my projects. kekw trying to make conversation

faint sparrow
#

Axios baddddd

#

kekwsanta jk

stone kayak
#

this is a great NPM project

#

I use it in production

#

500k downloads / week

#

very good for production

solar hull
#

oh, they've deprecated left-pad sadcooctus

#

but it still has 4M weekly downloads

stone kayak
#

as expected of the JS ecosystem

surreal bronze
#

Yes.

#

Google does.

vague loom
twilit thunder
#

So how do i use Js? Do i download an application?

#

I'm fresh fresh to coding and stuff

vague loom
#

Please do your own research before asking here

twilit thunder
#

...

#

Ok.

#

Sorry.

#

Uhhhh... I found something called node.js, does that have anything with using java script?

vague loom
twilit thunder
#

Ohhh

#

Thank you,

#

Wait,

#

So i download it?

#

?

vague loom
#

You can

twilit thunder
#

ok.

#

Right???

vague loom
#

Yep

twilit thunder
#

ok.

twilit thunder
#

I need to learn how to start writing the codes in Node.js

surreal bronze
#

ok

#

search that on yt or google

twilit thunder
#

Ok.

surreal bronze
#

@humble venture

#

DDOS is illegal and unethical

#

Its good to see you learning, but you should be making more ethical programs

humble venture
#

-undelete -a

calm halo
#

is there a way to specify a linux AND a windows shebang line in a python script or does it have to be either or?

onyx merlin
#

Unless you are using cygwin, windows has no shebang support. However, when you install python, it add as file association for . py files. If you put just the name of your script on the command line, or double click it in windows explorer, then it will run through python.

onyx merlin
calm halo
#

oh okay, i thought in windows you should specify #! python3

onyx merlin
#

it does nothing, it will run with the default system python if you double click it

calm halo
#

nice, thanks for the info. 🙂

rich steppe
surreal bronze
#

well this is interesting

surreal bronze
#

From @tulip ibex

tulip ibex
#

seriously...u didnt need to say from me

surreal bronze
#

Oh I thought you would want credit lol

#

Sorry

rare kestrel
hushed mica
#

Thankfully i got in and subscribed to it, but i haven't "done it" yet

thick wadi
#

I have a doubt about mono substitution cipher... If we don't have the key and we only know a pair of ciphertext and plaintext... And we have another ciphertext, then how can we decode the ciphertext to plaintext??

lilac holly
#

guys can you help me with wire shark?

vernal vigil
#

is this related to a room @lilac holly ?

lilac holly
#

idk

#

Im new

vague loom
lilac holly
#

what can I do with it?

vague loom
#

It’s for analysing network traffic

lilac holly
vague loom
#

Yes it can be used for hacking

lilac holly
vague loom
lilac holly
#

etc

vague loom
#

That doesn’t really explain why if you want you can dm me and explain in more detail

lilac holly
#

ok

white hill
#

Hello, i wanted to ask about the malware analysis room.Do i need to know first how to program before going there ? and if yes is C++ good for starting because i'm trying to learn it.

vale moat
#

im not really into that but i'd say c++ is definitely helping a lot

#

but i'd start to learn the basics of programming first

vale moat
#

(before learning c++, since it's really hard to understand all the functions/data types etc)

white hill
#

I know like i spend so many hours watching videos ,bought a book and i feel like i'm on chapter 1 learning C++.

lilac holly
#

you can start with c++, but it's going to be harder than with other languages

#

but it's definitely doable

chilly tide
#

I am confused little bit, we can run python 2 and python 3 codes on Kali. By default when we installed Kali machine we have python 2 and 3 both on Kali or not?

onyx merlin
#

@chilly tide both.

chilly tide
stone kayak
#

its 2

#

You can tell because its print "hello" and not print("hello")

vernal vigil
#

Cout << hello world

#

fmt.Println(Hello World)

chilly tide
#

ok thanks guys. thats a good indicator

surreal bronze
#

ew

#

python2

#

gross

tidal panther
#

thats not what you were saying in the 90s

surreal bronze
#

true kekw

tulip sail
#

Don't knock it until you've tried writing a BoF in Python3

true pumice
#

Someone recently tried to code a BoF script in python3

tulip sail
#

It's possible. Just a pain in the rear end with the encoding

true pumice
#

They tried so hard to get it to work and I was like.. use python2 and they instantly found it easier

#

It's still useful aniguns

surreal bronze
#

Yep, I guess python2 can be useful at times for things python3 isnt yet really compatible with like as you said BoF, but I find it way harder to program in 2

tulip sail
#

I did the same thing when I was learning to build them -- scoffed at Offsec still using Python2, thought I knew better, and tried doing it in Python3

#

Worked absolutely fine until I tried sending it shellcode 😆

tulip sail
#

Same as the people who fail to use Vim
Couldn't resist

surreal bronze
#

I've personally had loads of problems with py2 and thats not just for programming in it

surreal bronze
tulip sail
#

Incredibly so

brazen eagle
tulip sail
#

Oof, that'd do it for writing

#

Doing it over a network is worse though -- even with a raw socket you need to encode it just right

brazen eagle
#

I was stuck on the first BOF for Theseus because of python3

#

:(

#

You can't send raw Bytes over a socket?

tulip sail
#

Nope, indeed you cannot -- not the same way anyway

#

No, that's not true

brazen eagle
#

Those things must be buffered as well...

tulip sail
#

You can, but because of how Python3 handles encoding, they need to be specifically encoded as bytes

brazen eagle
#

Right that's what I thought

tulip sail
#

You can't just throw a string with \x characters in it into the socket

brazen eagle
#

And if you aren't typing your things properly you're doing it wrong!

tulip sail
#

It's some stupid encoding method as well iirc. From memory utf-8 doesn't cut it 😆

brazen eagle
#

Latin-1 doesn't either

#

The world needs extended-ascii again

#

Haven't tried the network bof room yet

vague loom
stone kayak
true pumice
vague loom
#

I only came it across yesterday and haven't got enough of it 😄

#

Great site as well can go from very easy to hard

true pumice
#

I'm not a fan of the wait time but I guess I'm just being privileged kekw

stone kayak
#

Jabba it's basically just another CP site 👀

surreal bronze
#

@stone kayak How do I 1v1 you?

stone kayak
#

create a room

#

and only let 2 people in

#

its a competition

true pumice
#

Bee

#

Lets do it

#

You'll win but still

stone kayak
#

i probably wont

#

its gonna select the really weird easy questions cause i've done half of all the easys LMAO

true pumice
surreal bronze
#

I put self-taught lmao

true pumice
#

I put computer science kekw

stone kayak
#

its a really nice platform

#

reminds me of THM when it wsa younger 😄

surreal bronze
#

ive forgotten my freaking email login

#

😢

stone kayak
#

is no one gonna join the room or

surreal bronze
#

how do i join

true pumice
#

I can't signup

surreal bronze
#

I've signed up

true pumice
#

won't send me a verification email

surreal bronze
#

but how do I join

stone kayak
surreal bronze
stone kayak
#

click that

surreal bronze
#

again

true pumice
#

Oh I'm in

stone kayak
#

jabba jay and i are having major fun rn

surreal bronze
#
class Solution:
    def solve(self, nums):
        nums.sort()
        diffs = []
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] + nums[i]))
        for possible in diffs:
            for i in range(0,len(nums) - 1):
                if abs(nums[i] - nums[i + 1]) != possible:
                    break
                else:
                    return True
vague loom
#

I left because my brain isn't big enough for that 😦

stone kayak
#

thats 3 loops

#

i did 1 loop

surreal bronze
#

the 1,0

#

is cocking up

#

me

#

how did you do one loop?!

stone kayak
#

delete all your code

#
        nums.sort()
        diffs = []
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] + nums[i]))
#

i only have this

#

as my only loop

#

and uh

#

thats also wrong

#

small bug

surreal bronze
#

yeah I did that

stone kayak
#

but thats my loop 🙂

surreal bronze
#

oh wait

#

why not

#

i + 1

#

why just i

stone kayak
#
class Solution:
    def solve(self, nums):
        diffs = []
        nums.sort()
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] - nums[i + 1]))

I have 3 more lines of code that I'm not gonna show ya

#

as you haven't figured it out yet 😄

surreal bronze
#

oh wait

#

thats

#

O

stone kayak
#

it's O(n)

#

yours is O(n^2 + n)

#

@vague loom @true pumice its giving us harder "easy" questions because i've done most of the super easy ones btw

#

and its a competition

vague loom
#

I need to learn more before I even do any of this 😄

stone kayak
#

two sum is v/ easy

surreal bronze
stone kayak
#

its on the site

#

if you do easys on the site by yourself it'll be actually easy btw

surreal bronze
#

I need to like

#

check the list

#

each element

stone kayak
#

no

#

you dont

surreal bronze
#

if its 1+,1- the next element

stone kayak
surreal bronze
#

Yeah but I checked to see if they are all the same

stone kayak
#

you're not thinking outside the box

stone kayak
#

bingo bingo bingo

surreal bronze
#

yeah but I did that

stone kayak
#

you got it

surreal bronze
#

I did that

#

and it failed

#

I did

#
                return True```
#
class Solution:
    def solve(self, nums):
        diffs = []
        nums.sort()
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] - nums[i + 1]))
            if(len(set(diffs))==1):
                return True```
stone kayak
#

thats in the loop

#
        if len(list(set(diffs))) == 1:
            return True
        return False
#

my code

surreal bronze
#

YOOOOOOOOOOOOOOOOOOOOOOO

stone kayak
#
class Solution:
    def solve(self, nums):
        diffs = []
        nums.sort()
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] - nums[i + 1]))
        
        if len(list(set(diffs))) == 1:
            return True
        return False
#

was my code

surreal bronze
#
class Solution:
    def solve(self, nums):
        diffs = []
        nums.sort()
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] - nums[i + 1]))
        if(len(set(diffs))) == 1:
            return True
        else:
            return False```
#

yup

#

and I probably dont even need the else

stone kayak
#
class Solution:
    def solve(self, nums):
        diffs = []
        nums.sort()
        for i in range(0, len(nums) - 1):
            diffs.append(abs(nums[i] - nums[i + 1]))
        
            if len(list(set(diffs))) != 1:
                return False
        return True
#

this works

#

but it TLE

#

cause of the set

#

TLe = Time Limit Exceeded

#

its too slow

surreal bronze
#

ohhh

stone kayak
#
# class Tree:
#     def __init__(self, val, left=None, right=None):
#         self.val = val
#         self.left = left
#         self.right = right
class Solution:
    def solve(self, root, target):
        def search(root, target):
            if root is None:
                return root
            
            if root.val == target:
                return True
            
            if root.left is not None:
                return search(root.left, target)
            if root.right is not None:
                return search(root.right, target)
        
        if search(root, target) == True:
            return True
        else:
            return False
        
#

i felt like i was so close with this

#

@true pumice @vague loom thats an easy problem btw

#

@surreal bronze if you do an easy comp by yourself you'll find it's way easier than what we just had hahahaha

stone kayak
#

and then create room

surreal bronze
#

phh

#

*ohh

#

k

#

cheers

stone kayak
#

94% clearance rate on the binary tree question lol

solar hull
#

That site looks like something i could look into

chilly tide
#

i am working on CTF beginer room, i find this python exploit through exploit-db.https://www.exploit-db.com/exploits/46635. its giving me an error, i tried in both versions of python like in 2.7 and 3.8 and both times i get different coding errors i also highlight everything. i know this is a dumb question. i don't know what i am doing wrong.

onyx merlin
surreal bronze
tepid cargo
#

leaving it here for bee

stone kayak
#

that's prett coooool

sharp coral
#

welp I started off looking for a simple way to look at old followers on twitter so I can clean up my feed a bit and ended up knee-deep in Twitter API v2. Really cool stuff and they make it dead simple with some code snippets, e.g.

# grab list of 100 most recently followed account for a particular user and pretty print json
curl https://api.twitter.com/2/users/<numericalID>/following?max_results=100 -H "Authorization: Bearer $TOKEN" | jq -r "." | tee pretty_printed.txt

https://developer.twitter.com/en/docs/twitter-api/users/lookup/introduction

gray ledge
#

What would you say a good place to start would be when trying to learn how to use APIs in python through requests

#

for example, the meaning of what droogy sent

sharp coral
#

honestly if you google any major API + 'python' you are bound to turn up loads of documentation, for example there are code examples for the Twitter API in python as documented here https://documenter.getpostman.com/view/9956214/T1LMiT5U

magic falcon
#

first step: understand how RESTful APIs accept requests and the forms data can be returned as. second step: proof of concept with curl and wget. third step: use HTTP request library for programming language of choice

gray ledge
#

thanks!

stray otter
#

i do the lazy way with python, import os, run the command and store output to a file then read that file, but i assume theres much better ways to do it

crystal ocean
#

Heyyy anyone here good in python?

stray otter
#

sometimes the api you want to work with has a module or port for your language of choice, blizzard for example has multiple, i was able to grab a python one so i can make my web based mobile auction house for World of Warcraft

#

i wouldnt say im good, but i have alot of hands on exp with python, whats up?

onyx merlin
#

That's highly unethical

#

Do not try to cheat on your exam.

crystal ocean
#

Dude our sir has teached for

#

5 days

#

And then giving a tough one

stray otter
#

what? whats going on

crystal ocean
#

I have a question can you solve it ?

stray otter
#

is it for an exam?

onyx merlin
#

-warn @crystal ocean Stop asking for us to help you cheat on your exam.

wispy kestrelBOT
#

⚠ Warned logaan_#2443

crystal ocean
#

Lol okay I'm sorry

#

😹🙌🏼

#

Okay ! Anyone can suggest me some videos or books on python

#

Not for exam for studying further

weary current
#

Hey there, i am developing an socket application where a user can create its own channel and other users can join that channel and there can be multiple channels so i am stuck at point that how can i open multiple connections for multiple channels

vernal vigil
#

i was looking at it the other day, might help u @weary current

weary current
#

ok let me check @vernal vigil

vernal vigil
#

Someone have also made a query on github, u might wanna check that too

weary current
feral pollen
#

hey

#

i want creat a tool

#

for sending and receive messages from facebook by selenium

#

using python

#

but i donn't know how to print the new messeage i obtain

#

help me

rain ermine
rain ermine
feral pollen
#

oh yeah

#

i donn't know

rain ermine
#

You can store the new message in a variable and with print print it

feral pollen
#

no

#

i cann't use selenium to receive the new message i obtain from faceook

#

facebook

onyx merlin
#

@feral pollen i bet you that's totally against the ToS.

#

I recommend using the API instead. I know there is one.

feral pollen
#

Graph API ?

onyx merlin
#

No, facebook messenger api

feral pollen
#

wow

#

oh tks

onyx merlin
#

Don't scrape/bot things that aren't designed to be

#

It's a good way to get banned from sites

feral pollen
#

nope

#

i just want

#

receive the new message from my friend

onyx merlin
#

Use the api

#

It's designed for that

feral pollen
#

and using AI for answer ...

#

ok thanks you

onyx merlin
#

I have a friend who's done that before

feral pollen
#

wow

#

so i donn't know

#

so much about API

onyx merlin
#

It's well documented

onyx merlin
#

There's probably a python library for it

feral pollen
#

and if i use fb chat document

#

hahah i haved checkpoint from fb

rain ermine
#

you can go testing the parameters with curl and then implement it in the script

onyx merlin
#

Or use a python library that probably already exists

onyx merlin
#

And not care about the raw requests.

#

Abstraction is a key concept.

#

Embrace it

rain ermine
#

It is so easy that you can mount it on a flak server and practice there you just have to use your head to implement it

#

You can even automate this entire process to a service like heroku

feral pollen
#

so i just want

#

ask

#

how to crawl the new message on facebook

#

using selenium

#

:V

#

use whar function ? and how ?

rain ermine
#

Do you want to send or receive a message

onyx merlin
rain ermine
#

Well I agree with Ninja about using the api

onyx merlin
#

It's actually illegal because you haven't got permission to scrape it.

feral pollen
#

ok

#

so i let's start use API T.T

rain ermine
#

Hahaha

long dawn
#

Until I know it depends on how are you gonna use the data scrapped, and what are you gonna do with that

#

Lot of people and extensions use web scrapping for search best prices, other to transform a web-chat to a basic comand line chat

long dawn
#

Just grab the message? what is the purpose?

feral pollen
#

yeah

#

i just want grab the newmessage

#

and using AI for analysis

#

and give she the answer

long dawn
#

You could create a bot instead

#

Thats why bots exist xd

#

Oh wait, I think you mean something like clever bot

feral pollen
#

yeah

#

yesss

#

i want creat a bot like simisimi

long dawn
#

yea i forget him name, i was trying to search it

feral pollen
#

ok thanks you

#

i really really wana see it

long dawn
#

is it ok if i dm you?

feral pollen
#

yes

#

plzzz

feral pollen
#

anyone

#

i want some project

#

for improve networking and python skill

#

can you guide me

rain ermine
#

What are you planning to do or what tool

onyx merlin
fervent mason
#

@client.commands()
async def command(ctx):
print('Send Embed ...')
embedVar = discord.Embed(title='Swag Goku', color=0x1abc9c,content=' https://tenor.com/view/dripgoku-swag-goku-gif-19831092',description = 'goku has drip')
embedVar.add_field(name="Field1", value="hi", inline=False)
embedVar.add_field(name="Field2", value="hi2", inline=False)
embedVar.set_footer(text='Footer', icon_url=discord.Embed.Empty)
await ctx.send(embed=embedVar)

#

can someone help pls

true pumice
#

This is for you discord bot, correct?

fervent mason
#

yes

#

im tryna get it to send embed messages

onyx merlin
#

You're missing a closing quote which should be super easy for you to see if you use a good IDE.

fervent mason
#

where

#

or am i just blind

#

i think im blind

true pumice
onyx merlin
#

Use a good IDE.

fervent mason
true pumice
#

I would also recommend interchangeably using " and '

#

If possible

onyx merlin
#

Jabba if you mix and match you will make me cry

true pumice
#

You are about to cry then 😎

#

I just prefer to use speech marks

#

And if I need to use speech marks again, I either escape the character or use quotes

onyx merlin
#

Jabba the issue there is they didn't close the quotes around the URL

true pumice
#

Allows my code to be distinguished because then you can easily follow the speech marks and quotes marks to know which part is being closed off. Just an opinion of mine.

#

Mhm

novel cobalt
#

I write the opening and closing quotes first, and then fill in.

ionic breach
lilac holly
#

someone good in python payloads?

onyx merlin
#

Just ask the question

lilac holly
#

my python rev shell for cutenews ain't working 😦

#

I changed the IPs accordingly

#

yet only a connecting message appears

#

I can't say more beucause this vuln ain't here yet

lilac holly
#

yet I want to know if the script is ok

fallen monolith
#

so you're doing an active htb box?

surreal bronze
tulip sail
#

Any C# whizzes able to recommend me an argparsing library (preferably with Documentation for linking it in with Visual Studio, given I started with this dang language about 6 hours ago 😆)

fair lion
#

anyone here heard of project euler by any chance?

clear needle
tulip sail
#

In hacking maybe, but there have gotta be CLI C# programs written for other stuff

clear needle
#

that should work

tulip sail
#

Interesting. One built into the System namespace, will take a look at that

clear needle
tulip sail
#

Aye, I saw the Options library earlier. I was going to try it, but figured I would check for other options before trying to figure out how to include it

clear needle
#

That’s about the only well recognized ones I can find

tulip sail
#

Could also do with this being static, so not just linking in DLLs

clear needle
tulip sail
#

That involves figuring out nuget

clear needle
#

nuget CLI is hard but VS has a built in nuget manager that makes it really easy to find and add libraries

tulip sail
#

Faiiiir

clear needle
#

and the .net arg parse won’t require any libraries afaik

brazen eagle
#

Use nuget

vernal vigil
#

the error am facing is 'value' not defined/not used

onyx merlin
#

Define it outside the scope?

vernal vigil
#

i tried that but still facing the same thing

#

let me actually share what i am doing

#

one sec

onyx merlin
#

Definite it before the for loop

#

Because you never actually declare it

vernal vigil
#
package main

import (
    "encoding/base64"
    "fmt"
)

func main() {
    Encoded_string := "dog"
    for i := 0; i <= 50; i++ {
        Encoded_string, error := base64.StdEncoding.DecodeString(Encoded_string) // Encoded_string on this line is the issue
        if error != nil {
            fmt.Println("Error =", error)
        }
    }
    fmt.Println(Encoded_string)
}```
#

just imagine there is a base64 string instead of 'dog'

fair lion
#

what makes golang special over other programming languages?

hollow tangle
# vernal vigil ```go package main import ( "encoding/base64" "fmt" ) func main() { ...

It's because base64.StdEncoding.DecodeString returns a []byte but Encoded_string is a string https://golang.org/pkg/encoding/base64/#Encoding.DecodeString since you are using := for assignment it will try to shadow Encoded_string as a []byte inside the for loop and then go out of scope I would recommend just making two variables one holding your decoded string (or []byte since that's what base64 returns) at the return and one holding the encoded string

vernal vigil
#

Gotcha

hollow tangle
#

It's not the best but use this as reference

package main

import (
    "encoding/base64"
    "fmt"
)

func main() {
    var Decoded_string []byte

    Encoded_string := "ZG9n"
    for i := 0; i <= 50; i++ {
        var err error
        Decoded_string, err = base64.StdEncoding.DecodeString(Encoded_string)
        if err != nil {
            fmt.Println("Error =", err)
        }
    }
    fmt.Println(string(Decoded_string))
}
vernal vigil
fair lion
#

oh ok

#

can i post a github link here

stone kayak
#

like a project?

#

you made?

fair lion
#

yeah

#

would be easier to post here since its relevant to the discussion here

#

its not really a resource either, just a personal project

peak wraith
#

Could anyone help me get good at coding and hacking and stuff

#

I pretty new but dedicated

peak wraith
#

Ive been on faq a bit someone suggested it to me

#

On another server

surreal bronze
#

Well

#

What language would you like to learn

#

Or are you unsure

#

For python

peak wraith
#

I dont even know what that is

#

Im still rlly new

#

I wanna get good tho

surreal bronze
#

Start learning python

peak wraith
#

Ok

surreal bronze
#

For projects

#

I always find the best way to learn is to actually do your own projects

#

Starting small and gradually getting bigger

#

Feel free to ask for help here

#

Also this channel pins have some pretty good links to

peak wraith
#

Ok ill have a look at them

neon shadow
#

Hello, New to the channel. I was wondering what would be a great program language to start learning to build some foundation in cyber security? Some say C some say Python etc.

magic falcon
#

Depends on your learning goals, and what you want to get out

#

C is better to learn system internals, python is faster to get something usable

neon shadow
#

Thank you juun!

#

Which is easier to learn?

magic falcon
#

Python abstracts out a lot of the harder concepts of C. There are pros and cons to each language

neon shadow
#

Ok great I will learn both.

magic falcon
#

Don't learn both at the same time if you are new to programming

#

that is a great way to confuse yourself

neon shadow
#

OK haha!

vague loom
#

There are some great resources that are pinned check them out

mystic nimbus
#

best would be to identify what you want to do with the programming language first, then you can identify which one to use

magic falcon
#

Pick a language until you know the basics of programming really well

#

then you can branch out and not end up horribly confused

neon shadow
#

Thanks everyone!

#

I seen the pinned items as well and yes ill check those links out.

lilac holly
tribal smelt
#

is there a way to work out which nav button is clicked to dynamically select the page needed?

      <li role="presentation" class="dropdown-header"><a role="menuitem" href="#session1">Session 1</a></li>
      <li role="presentation" class="dropdown-header"><a role="menuitem" href="test.php">Session 2</a></li>
      <li role="presentation" class="dropdown-header"><a role="menuitem" href="#session3">Session 3</a></li>

<?php echo file_get_contents("html/header.html"); ?>`
<?php echo file_get_contents("html/session<NUMBERHERE>.html"); ?>

So I don't have to make a page for each session?

brazen eagle
#

Most frameworks such as react, vue or angular can do single-page apps. There are also others

#

PHP might have some as well, I don't know those very well though

stone kayak
surreal bronze
onyx meadow
#

guys iam sry for bieng silly

#

but as u can see in the last blocks of code

#

iam using the return funciton for colors

#

what i want to do is to draw a traingle

#

but i cant

#

python just ignores my commands

#

can anybody tell me what i am doing wrong

#

feel free to ping me

magic falcon
#

i really good question to ask yourself is 'am i spelling everything correctly for how i am using it'

faint pike
#

what does return have to do with colors

spare river
#
print('Hello World')

Am progrem man haha

true pumice
distant shard
#

@onyx meadow

def traingle():
  for sides in range(3):
      baraa.forward(100)
      baraa.right(360/3)
  # baraa.color("red")
traingle()

This part of your code does draw a triangle

#

The reason your other function doesn't work is because:

if i %3 == 1 :
      return "green"

This returns your function at the first iteration because 1 % 3 == 1, it then returns a value that is never used.

#

You're also not using the color parameter anywhere in that function so it's redundant

#

It also doesn't draw anything in the for-loop.

#

It just sets the color.

#
def triangle(color):
  for i in range(3):
    if i % 3 == 0:
      baraa.color("red")
      baraa.forward(100)
      baraa.right(360/3)
    elif i % 3 == 1 :
      baraa.color("green")
      baraa.forward(100)
      baraa.right(360/3)
    else:
      baraa.color(color)
      baraa.forward(100)
      baraa.right(360/3)
#

Now you're running into a DRY problem, where you're repeating baraa.forward(100); baraa.right(360/3)

#

So move the forward/rights under the conditional and let that just handle the setting of the color.

#

So you end up with:

def triangle(color):
  for i in range(3):
    if i % 3 == 0:
      baraa.color("red")
    elif i % 3 == 1 :
      baraa.color("green")
    else:
      baraa.color(color)
    baraa.forward(100)
    baraa.right(360/3)
true pumice
#

Not sure what the purpose of the program is but I would do this:

def triangle(color):
  for i in range(3):
     baraa.color(color)
     baraa.forward(100)
     baraa.right(360/3)

if var == 0:
  triangle("red")

elif var == 1:
  triangle("green")
distant shard
#

I assumed he was trying to make a triangle with three different colored edges

true pumice
#

Oh I sent that without checking it

#

Oops

distant shard
#

He said the return functions were for colors so I assumed he thought that they would somehow set them.

#

I could be wrong of course.

true pumice
#

If they do want three different coloured sides, I think the whole i % 3 if statement voids the use of the for loop

distant shard
#

I'm not entirely sure why it's even a modulo.

#

Instead of just i == 1; i ==2; ...

true pumice
#
def Triangle():
  colours = ['Red', 'Blue', 'Green']

  for colour in colours:
     baraa.color(color)
     baraa.forward(100)
     baraa.right(360/3)

Unless the i % 3 has a specific purpose

distant shard
#

That's much better, yes. I just wanted to stay close to his code while still having it work.

#

Looking at his code, I don't think it has.

true pumice
#

@onyx meadow Would you like to enlighten us?

#

And obviously you can change this to be user input:

def Triangle(colour):
  colours = ['Red', 'Blue', colour]

  for colour in colours:
     baraa.color(color)
     baraa.forward(100)
     baraa.right(360/3)

or

def Triangle(colour1, colour2, colour3):
  colours = [colour1, colour2, colour3]

  for colour in colours:
     baraa.color(color)
     baraa.forward(100)
     baraa.right(360/3)
brazen eagle
#

that's somewhat better

stark remnant
#

Can anybody help me with dbus @everyone i am trying to integrate some functionalities from dbus to develop a project using python

true pumice
#

Please do not try to ping @everyone

#

Just means no-one will help you.

stark remnant
#

My bad

#

Do you have any clue ?

true pumice
#

You have not detailed your program whatsoever 🤷

stark remnant
#

its a notification manager

#

For linux

stone kayak
#

Jabba be like:

Python is so ugly ewww
Jabbas code be like:

def hello_world():
  x = ["hel", "lo", "wor", "ld", "!"]
  print(''.join(x))
def hello():
  x = ["hel", "lo", "wor", "ld", "!"]
  print(''.join(x[0:1])
def world():
  x = ["hel", "lo", "wor", "ld", "!"]
  print(''.join(x[3::])
def hel():
  x = ["hel", "lo", "wor", "ld", "!"]
  print(x[0])
true pumice
#

Python is ugly

#

It looks horrible

#

I'm literally switching languages because Python looks bad

stone kayak
#

how hard is it to just

#

black

#

at leat use typescript

#

smh