#programming
1 messages · Page 17 of 1
oh, thanks!
Np 🙂
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))```
anybody i'm having problem with the python pip
yes
i've just installed the module, but when i run it, the interpreter can't find that module
linux? or win
which module/
most of my installed module
i never had a problem
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
Noticed today that pip3 search is removed 😢 sadface
I have the same problem with any module on VSC. If i want to use modules I just use Pycharm since i can modify the files and import it there.
well i'll try it later, ty for the solution
lol the python binded in my computer is targeting the inkscape python, not the actual python
bruh
that's pretty hilarious
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)
'||
What do you mean you’re trying to compare rockyou with something?
remove lines that appear in rockyou.txt from easyctf.txt
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
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^
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.
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
You don’t have to load more than 1 line into memory at a time
If you look at that last link
I promise I will fully learn python in the future but for now it's a copy/paste! food now so brb but thanks!
@rigid tapir type it out instead of copy paste
It’s weird but I promise it helps you learn
After much trial and error, i think it was the f.readlines() that was causing the memory spike. afte rremoving readlines() it worked:
||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)||
🥳
Anyone here good with sed or awk? I've google'd my ___ off and can't figure out this problem.
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.
Find an end character to split on and grab the stuff before that
I usually grab the .gnmap file for that kind of post processing.
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
?
wut the heck
what??
check the pinned msg. by muiri on how to make code blocks in discord
ok
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?
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
?
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
so is it possible or not
as i said. depends on the validation code that u got.
it might be impossible it might be possible.
so wat is the easyest way to crack a pass
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
lemma do some reaserch on thumb dictionary attacks
thks
is the attack called thumb dictionary
i googled it and no results
no no. "dictionary attack" is the attack name.
i said "rule of thumb" sorry for the absense of punctuation marks.
what do u mean.. just google "password cracking dictionary attacks" or somehting along the lines.
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 🙂
@spiral glen What are you trying to use it for?
experimenting
For what
What are you testing it on though
oh ok
on a programm i made??
I think what they're asking is, what are you trying to crack the password of?
wut
You can't know if it works if you don''t test it
oh
on my computer
What file
If you have nothing to hide, you should easily be able to answer my questions.
So you're trying to brute force your own computer password?
And how does that work?


i would do it with grep -o
Can someone suggested me a final year project ?
about web, android..?
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. 🤣
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)
Firewall.
i disabled that
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
Defender?
i checked my code again and again i didn't find any bug
so can u like debug it? like putting printfs here and there? that way u can pinpoint what is happening.
no no i didn't that i fully copy this code 🙂 from the course and i checked/match it with the original code that's all
maybe no
yeah. so as the environments are different put some logs to pinpoint the problem. After that u can remove the log and compile
can i share the code?
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.
yeah
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
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?
because i copied it from course and in course the code work properly
that's like step1 of any troubleshooting if u don't have unit testcases.
nice idea ok i will try
Ok but stuff might have changed
lol i am trying to tell u from the first msg 🤣
hey i tried it in main i just add printf("hello"); when i compiled and run the program it doesn't show any result
Can you send the code here please?
Don't see this anywhere
no i simply run the program but it doesn't print anything
@tepid cargo bro what is the problem any idea
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.
bro i findout the bug
the bug //sock=socket(AF_INET,SOCK_STREAM, 0);//
it is the imposter
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
everything is ok but i cannot fix this sock line
u changed the server_address.sin_addr.s_addr right?
no
it is for ip address
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.
but its work it is from google
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?
bro please delete this messege
?
this one
thanks
why tho
private IPs 
Just try to make it from scratch
More fun that way and you learn more
No point in copying code
i mean, honestly doing something from scratch is waste of time if you know how things work already.
I would never do it.
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
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.?
is it possiable to create your own firewall, so that way you don't have to buy one 
there are open source ones though. is snort a firewall? that's free lol

snort is an IDS, not really the same thing
yeah yeah exactly. intrusion detection system
i forgot the term completely 🤣
thanks juun ❤️
only thing is I have no clue how to do any of this 
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
0.0
I have also had a fortigate 200E, the DMP is by far more friendly for people without a strong networking background
You can go back and do AOC from previous years if that interests you
all the competitive programming sites like leetcode etc?
yeah bee recommeneds binarysearch.com
that's actually pretty nice
maybe nicer than leet code if u consider that 30$ per month paywall
kattis is lesser known but nice too, usually used by unis tho
the katas emails annoyed me until i unsubscribed LOL
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.
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
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.
hey if somone gets one of my acc can i know what he is going with my acc
Hm?
??
@spiral glen sir. do i know u? why the friend request?
can u answer me
🙂
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.
Please respect the rules :)
Nope
like will he delete the acc
is it impossible
hmmmmmmmmmmm
k
spotify acc
for example if they get ur netflix account u can check it in the viewing logs
then u probably can see the log as last played songs?
which u didn't play
i did not mean like tat
then form a proper question?
if he gets my acc can i like give my acc a virus and destroy his computer
that's a mod thing. @true pumice sir
is it
cause wat if he hacked my acc and i wanted to do something back
hmm
how was the above conversation anything related to programming 
Get the JomaClass membership: https://joma.tech/38wHNoq
First 100 people get 15% off the yearly subscription with promo code "DONUT"
Donut C article by Andy Sloane:
https://www.a1k0n.net/2011/07/20/donut-math.html
Music by Joy Ngiaw
https://www.joyngiaw.com/
📚 Video courses from JomaClass:
🎓 New to programming? Learn Python here: https://jom...
this is absolutely awesome and pretty legit.
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
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.
no actually i have a pipeline with multiple stages i want to able to run the 2nd stage without running the first.
yeah i have made it manual
Hope that helps - I have more experience with tekton and jenkins than GOCD
yeah yeah no worries. let me see if i can find anything.
DM me i can help you
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
Very cool for someone who's new to the language :)
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
You didn't break out of the loop
Oh?
nightmares arnt over
They never are
Oh. That's not good
thanks for giving nightmare
You're welcome
now just i have to be safe that i dont get out
Does any one know how to get access to someone’s email without the password
O.o
I mean
Social engineering could get you the password
But I would think you’d have to be pretty damn good
No, and even if somebody here did it's unethical & illegal so we wouldn't tell you
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
if a user have write privleges to etc/passwd
you can make a new root user
thats atleast my idea
Something like this?
echo "naughty:x:0:0:naughty:/root:/bin/bash" >> /etc/passwd
Naughty it auto-hashes the password
Add the hash instead of x.
password = input("Insert Password:\n")
Didn't check it
print("chech what type of hash your distro is using:")
On phone and travelling, my bad
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?
:)
Can we not encourage illegal activity please?
Does any one know how to find the email addr of a steam account?
@pallid valley why?
for gathering information ?
What do you mean?
Sounds legit 🤓
guys can i ask for help about programming
Just ask your question
guys my program ignores my if statement any help
that's why
Spooks is about to explain why
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")
It needs to match everything inside the speech marks
^
man I did it like this but somehow it didnt work
it needs to be exact
You need the space afterwards as well
To this
its clearly causing confusion lol
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")
plus if you put the space in the wrong spot you will get errors
What?
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
I love the irony in that 4 minutes after this message there was another one
??? What are you trying to achieve???
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...
hello everyone , please is there someone who knows how to programme in risc-v assembly ?
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.
hey everyone
i have question
how can i by pass payload using apktool in kali linux
You have to do signature in order to have it installed in the Victim device (for every edits on payload)
Maybe a click here will help
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
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
yeah its just a bit confusing since its the exact opposite of how the mov command works
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
yeah the AT&T is src,dst
but the compare statement is also flipped round so maybe i'm not understanding something
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
Hi
trim and tolower plez.
leg they're new I'm not massively changing their program lmao
plez do.
it is fun
seems legit measurement unit 
Hi 🙋♂️
@tepid cargo i just met CS Dojo in a CP contest LMAO
Can we copy to clipboard using the linux terminal ??
look up xclip
ehhhh
that's dope
That's external , but anything like "pbcopy" in here ? I just can't do clip or pbcopy :(
Xclip works fine bud ;)
So in the end it works for your problems or not? 😹
Of course not, cuz I'm looking for inbuilt modules..
ohh sorry I did not understand your question then @tiny violet
No u did
It's the same thing
Still looking for an inbuilt one cuz i gotta hash and sumbit the work
Do you mean like a python module?
someone talk about npm packages as well pls

axios is a good one. i use it in most of my projects.
trying to make conversation
this is a great NPM project
I use it in production
500k downloads / week
very good for production
as expected of the JS ecosystem
Giraffe Academy is rebranding! I've decided to re-focus the brand of this channel to highlight myself as a developer and teacher! The newly minted Mike Dane channel will have all the same content, with more to come in the future!
Source Code - http://www.mikedane.com/programming-languages/python/
This video is one in a series of videos where w...
So how do i use Js? Do i download an application?
I'm fresh fresh to coding and stuff
Please do your own research before asking here
...
Ok.
Sorry.
Uhhhh... I found something called node.js, does that have anything with using java script?
You can
Yep
ok.
I need to learn how to start writing the codes in Node.js
Ok.
@humble venture
DDOS is illegal and unethical
Its good to see you learning, but you should be making more ethical programs
-undelete -a
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?
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.
No such thing as a windows shebang
oh okay, i thought in windows you should specify #! python3
it does nothing, it will run with the default system python if you double click it
nice, thanks for the info. 🙂
yes node.js is the back end for javascript
I think that went well! Head over to github to see some of the code involved.
https://github.com/standupmaths/xmastree2020
This is the original video:
https://www.youtube.com/watch?v=TvlpIojusBE
The behind-the-scenes videos are on Patreon:
https://www.patreon.com/posts/behind-tree-45862331
well this is interesting
seriously...u didnt need to say from me
wow this is nice. Has anyone done it? 🙂
Thankfully i got in and subscribed to it, but i haven't "done it" yet
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??
guys can you help me with wire shark?
is this related to a room @lilac holly ?
What do you need help with?
what can I do with it?
It’s for analysing network traffic
but it says its a hacking tool
Yes it can be used for hacking
how? can you help me?
Sure but what are you trying to do with it?
That doesn’t really explain why if you want you can dm me and explain in more detail
ok
I wrote to you pv
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.
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
No, you don't
(before learning c++, since it's really hard to understand all the functions/data types etc)
I know like i spend so many hours watching videos ,bought a book and i feel like i'm on chapter 1 learning C++.
you can start with c++, but it's going to be harder than with other languages
but it's definitely doable
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?
@chilly tide both.
https://www.exploit-db.com/exploits/46635. so this exploit is in pyhton 2 or 3?i think it is in 2 but i am not sure. i know it is a dumb question 😦
ok thanks guys. thats a good indicator
thats not what you were saying in the 90s
true 
Python2 still has its place, as discussed
Don't knock it until you've tried writing a BoF in Python3
Someone recently tried to code a BoF script in python3
It's possible. Just a pain in the rear end with the encoding
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 
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
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 😆
The fact you can't use it doesn't make it gross 🤷♂️
Same as the people who fail to use Vim
Couldn't resist
I said I find it harder to use it
I've personally had loads of problems with py2 and thats not just for programming in it
I find vim too complicated, but i'm sure it must be very efficient for people who know how to use it all 
Incredibly so
Can confirm it's a pain. sys.out.buffer.write or something like that
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
I was stuck on the first BOF for Theseus because of python3
:(
You can't send raw Bytes over a socket?
Those things must be buffered as well...
You can, but because of how Python3 handles encoding, they need to be specifically encoded as bytes
Right that's what I thought
You can't just throw a string with \x characters in it into the socket
And if you aren't typing your things properly you're doing it wrong!
It's some stupid encoding method as well iirc. From memory utf-8 doesn't cut it 😆
Latin-1 doesn't either
The world needs extended-ascii again
Haven't tried the network bof room yet
Really good site for programming challenges, such as Python, JS, C, Swift and much more. They also have tutorials https://edabit.com/challenges
I use Emacs now btw
lemme add to the pins
What have you done to me I'm addicted 😭
I only came it across yesterday and haven't got enough of it 😄
Great site as well can go from very easy to hard
I'm not a fan of the wait time but I guess I'm just being privileged 
Jabba it's basically just another CP site 👀
1v1 me on https://binarysearch.com
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
@stone kayak How do I 1v1 you?
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
i probably wont
its gonna select the really weird easy questions cause i've done half of all the easys LMAO
I put self-taught lmao
I put computer science 
easy 4 questions
its a really nice platform
reminds me of THM when it wsa younger 😄
is no one gonna join the room or
how do i join
I can't signup
I've signed up
won't send me a verification email
but how do I join
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
click send
click that
again
Oh I'm in
jabba jay and i are having major fun rn
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
I left because my brain isn't big enough for that 😦
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
yeah I did that
but thats my loop 🙂
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 😄
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
I need to learn more before I even do any of this 😄
two sum is v/ easy
bruh welcome to the club
if its 1+,1- the next element
nope
Yeah but I checked to see if they are all the same
you're not thinking outside the box
bingo!
bingo bingo bingo
yeah but I did that
Bee the explanations sucked
you got it
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```
YOOOOOOOOOOOOOOOOOOOOOOO
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
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
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
ohhh
# 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
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
@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
how do I do that
94% clearance rate on the binary tree question lol
@surreal bronze add me as a friend too! 😄 https://binarysearch.com/@/beesan
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
That site looks like something i could look into
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.
It's python2
#room-help for help with tryhackme rooms
your running a python2 script in python3
leaving it here for bee
that's prett coooool
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
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
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
This is a Postman Collection for the Twitter API v2 endpoints.
Refer to the main Twitter API documentation for more details.
If you have an API-related question, you can also discuss in the developer community forum.
Installation
Quick install
Go to the [Collec...
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
thanks!
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
Heyyy anyone here good in python?
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?
This is an exam
That's highly unethical
Do not try to cheat on your exam.
what? whats going on
I have a question can you solve it ?
is it for an exam?
-warn @crystal ocean Stop asking for us to help you cheat on your exam.
⚠ Warned logaan_#2443
Lol okay I'm sorry
😹🙌🏼
Okay ! Anyone can suggest me some videos or books on python
Not for exam for studying further
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
ok let me check @vernal vigil
Someone have also made a query on github, u might wanna check that too
in python
i am developing that in python @vernal vigil
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
Does the print function work for you?
You can store the new message in a variable and with print print it
no
i cann't use selenium to receive the new message i obtain from faceook
@feral pollen i bet you that's totally against the ToS.
I recommend using the API instead. I know there is one.
Graph API ?
No, facebook messenger api
Don't scrape/bot things that aren't designed to be
It's a good way to get banned from sites
I have a friend who's done that before
It's well documented
There's probably a python library for it
you can go testing the parameters with curl and then implement it in the script
Or use a python library that probably already exists
Yes
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
so i just want
ask
how to crawl the new message on facebook
using selenium
:V
use whar function ? and how ?
Do you want to send or receive a message
Don't do that.
Well I agree with Ninja about using the api
It's actually illegal because you haven't got permission to scrape it.
Hahaha
.
It's a grey area, is it not?
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
What do you mean with this?
Just grab the message? what is the purpose?
yeah
i just want grab the newmessage
and using AI for analysis
and give she the answer
You could create a bot instead
Thats why bots exist xd
Oh wait, I think you mean something like clever bot
yea i forget him name, i was trying to search it
is it ok if i dm you?
anyone
i want some project
for improve networking and python skill
can you guide me
What are you planning to do or what tool
It's explicitly against their ToS.
@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
This is for you discord bot, correct?
You're missing a closing quote which should be super easy for you to see if you use a good IDE.
where
Use a good IDE.
ty
Jabba if you mix and match you will make me cry
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
Jabba the issue there is they didn't close the quotes around the URL
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
I write the opening and closing quotes first, and then fill in.
Same, I feel dirty if I don't
someone good in python payloads?
Just ask the question
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
but on a concurrent platform
yet I want to know if the script is ok
so you're doing an active htb box?
" > '
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 😆)
anyone here heard of project euler by any chance?
Typically C# isn’t used with arg parsers people just give the code and you have to compile it yourself i honestly haven’t seen any example of someone using an arg parse library with C#
In hacking maybe, but there have gotta be CLI C# programs written for other stuff
Interesting. One built into the System namespace, will take a look at that
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
That’s about the only well recognized ones I can find
Could also do with this being static, so not just linking in DLLs
Try to find a dependency library that you can just specify with nuget
That involves figuring out nuget
nuget CLI is hard but VS has a built in nuget manager that makes it really easy to find and add libraries
Faiiiir
and the .net arg parse won’t require any libraries afaik
Use nuget
the error am facing is 'value' not defined/not used
Define it outside the scope?
i tried that but still facing the same thing
let me actually share what i am doing
one sec
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'
what makes golang special over other programming languages?
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
Gotcha
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))
}
I am just learning it cuz its fun
yeah
would be easier to post here since its relevant to the discussion here
its not really a resource either, just a personal project
Could anyone help me get good at coding and hacking and stuff
I pretty new but dedicated
Check the pins
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
Start learning python
Ok
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
Ok ill have a look at them
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.
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
Python abstracts out a lot of the harder concepts of C. There are pros and cons to each language
Ok great I will learn both.
Don't learn both at the same time if you are new to programming
that is a great way to confuse yourself
OK haha!
There are some great resources that are pinned check them out
best would be to identify what you want to do with the programming language first, then you can identify which one to use
Pick a language until you know the basics of programming really well
then you can branch out and not end up horribly confused
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?
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

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
i really good question to ask yourself is 'am i spelling everything correctly for how i am using it'
what does return have to do with colors
print('Hello World')
Am progrem man haha
He is the Messiah!
@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)
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")
I assumed he was trying to make a triangle with three different colored edges
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.
If they do want three different coloured sides, I think the whole i % 3 if statement voids the use of the for loop
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
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.
@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)
that's somewhat better
Can anybody help me with dbus @everyone i am trying to integrate some functionalities from dbus to develop a project using python
You have not detailed your program whatsoever 🤷
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])

jk