#programming

1 messages · Page 5 of 1

remote echo
#

Instead it uses ownership model to determine lifetime of something and then drop it once it's out of scope ( or when we call drop explicitly)

#

as the crates ecosystem and dependency management in Rust in extremely easy, it can get away with std library being minimal!

surreal bronze
#

Tools vendor JetBrains has published its annual survey of development trends, this time based on responses from around 29,000 developers, and it shows the declining use of PHP and Ruby. Other notable results include increasing interest in Rust and Go, that 73 percent say they have experienced burnout, and that 50 percent of developers use […]

magic falcon
remote echo
magic falcon
remote echo
#

are you sure that breakpoint is after drop has executed?

magic falcon
#

Does drop have some sort of undocumented built-in async functionality?

remote echo
#

? don't think so

brazen eagle
#

but the GC is pretty magic

magic falcon
# brazen eagle Java does reference counting IIRC

Right, but even when references are are 0 (equivalent to strong pointer with zero references in C++) the java GC doesn't actually deallocate until it decides too, and calling the GC may not force the collection to take place

brazen eagle
#

well, Ok, it'll try to run the GC when it get a lull in the cpu

magic falcon
# brazen eagle yeah, hence the magic

I'm just surprised that it i was seeing similar behavior in rust, which doesn't explicitly say it but I think implies that the memory management behavior is different

brazen eagle
#

at least the recent versions aren't too heavily impacted perf-wise by the GC

brazen eagle
magic falcon
brazen eagle
#

yeah but I'm assuming it's still deterministic

magic falcon
#

It ought to be, I agree

brazen eagle
#

arg why is my ssh not working...bloody kickstart

magic falcon
#

kek, did you give it the right pubkey?

brazen eagle
#

yeah but I'm being a bit dumb

#

gave it the right pubkey but I may not have put it in the right place

magic falcon
#

i always screw up kickstarts as well

brazen eagle
#

it's a bit wierd because it mounts the disk and seems to do a chroot in post

magic falcon
#

that doesn't seem that odd - unless it's leaving the chroot as the default environment after the install is finished

#

then it's weird and it's broken

brazen eagle
#

I dunno

#

ssh server is being installed at least

#

ok I dunno what I did but it works now...

#

bloody aws and their bloody requirements for bloody ancient systems

#

stuck with a 4.18 kernel because they only thing that supports something more modern is ubuntu

magic falcon
#

gross

#

good luck with that

#

i think even rhel 8 and 9 are on 5.x kernels now

brazen eagle
#

waiting after AL2022

magic falcon
#

for sure fedora is

brazen eagle
#

CentOS 8 Stream is on 4.18

#

so I don't think RHEL8 is

#

CentOS 9-Stream doesn't import

magic falcon
#

let me double check

#

f36 is on 6.1

brazen eagle
#

f37 as well

magic falcon
#

oh, you're right. RHEL8 is 4.18

brazen eagle
#

yeah I'm installing it now

#

9 is on 5.15 I think

quick void
#

Hey, I've been working with SQL on w3schools in school, but I'd like to have a fully working db instead of having to write my inputs into a notepad. Is there a way to install a db software with a working db onto a usb drive so I can just plug it into any windows computer and work on it?

cold coyote
magic falcon
quick void
magic falcon
quick void
#

Yes I can plug a usb drive into a school pc, my personal computer is not the problem, I need the db to be portable so it will be the same db whether I plug my usb into my personal pc or a school pc.

cold coyote
#

You can setup SQL also and the move the DB into the usb drive then mount the DB but that is not easy

#

If you really need to use SQL but very heavy on memory

magic falcon
#

I wouldn't recommend doing that until after you learn the internals of how your db engine of choice behaves. Plugging in the USB isn't the problem, it's running an executable from that pendrive that may violate your schools policy with respect to unapproved software.

BEFORE YOU DO THIS, please go talk to the school IT staff and learn what the policy actually is. I have heard of students being suspended or expelled for violating IT policy this way.

quick void
magic falcon
cold coyote
#

Maybe they have a golden image to rebuild all PC when stuff goes wrong 😂

quick void
#

There is no policy and no IT team. Every once in a while you will find sillygoose installed on some computer, I was just trying to find out if it is possible to have an offline portable plug in db. If not, I'm content with it, if yes, I'll try to see if I can make it work.

cold coyote
#

I have changed the format file and my colleague what to play my file as was mentioned that was a game. It was very fun 🤩 that was 25 years ago, time of Netscape browsing 😂

signal crater
brazen eagle
magic falcon
brazen eagle
#

docker uses WSL as a backend as well

magic falcon
brazen eagle
#

still need a kernel backing the containers

magic falcon
#

does it? that makes me kind of sick, after using docker, podman, lxc on centos for so long

brazen eagle
#

I mean it's all cgroups and namespace magic anyways

magic falcon
#

that's true; i'm more irritated at the lack of virt options for containers on windows

brazen eagle
#

docker has windows containers

magic falcon
#

yeah

brazen eagle
#

but yeah I've never used them

magic falcon
#

but i have zero interest in using them for the foreseeable future

#

pretty much anything i would want to run on a host i already know on linux or the equivalent runs better

brazen eagle
#

Yeah

surreal bronze
#
async function loadNames() {
    const response = await fetch('https://api.warframe.market/v1/items', { mode: 'no-cors'});
    const names = await response.json();

(ERROR) </main.js> (:22) - Uncaught (in promise) SyntaxError: Unexpected end of input
#

Not sure what "end of input" means

#

Any ideas would be great

brazen eagle
#

Which one is line 22?

#

Also the response is likely empty or not json

surreal bronze
#

how can I check if the response is empty

brazen eagle
#

Are there any other headers on the browser?

#

What happens in curl?

surreal bronze
#

Yup

#

response.text gives nothing

#

eh, change it to http with a different site and it worked

brazen eagle
#

Oh PowerShell aliases curl to invoke-webrequest

surreal bronze
#

yh

bronze mist
#

I need to code a ROT13 decoder in js

magic falcon
#

for an assignment?

bronze mist
#

no, for a project

magic falcon
#

what kind of project?

bronze mist
#

caesar cipher

#

encoder/decoder

#

and i chose rot13

minor zealot
#

There should be plenty of resources online. Break it down in small chunks what needs to be done and research for it.

paper bolt
#

does anyone have google api experience? I have a security question regarding OAuth 2.0 and the safety of an app deployed for production

#

idea is I don't want to share a client_secrets.json.

hollow sorrel
brazen eagle
#

Sounds like homework

#

Though that might be an interesting coding test

lilac holly
#

Would it be beneficial to learn Javascript/typescript while studying cyber security?

#

I want to learn a language and I'm leaning towards python

#

However, I also discovered the game "screeps" so I'm curious if learning typescript/Javascript is worth it

#

TLDR: is learning typescript a good way to learning programming in the cyber security world?

onyx merlin
brazen eagle
#

Any language will help get the basics down. The rest is mostly learning the syntax

lilac holly
magic falcon
lilac holly
jolly lotus
#

Started off with python myself. Later went on to learn java, now doing quite a bit C++

vapid cloak
#

As someone who is not a masochist, I find the fact that I am endeavoring to learn C and code in it ironic. Ha. It’s only been a matter of days since I started, and am already getting the vibe, “this is how we used to do things the hard way” lmao. Like, I’m simulating OOP using structs and function pointers, and while I feel special (jk) I’m beginning to realize the major difference in effort this requires…. 🧐

magic falcon
wraith hearth
#

So In Learn Rust Room There's Question: What's the smallest sized signed integer in rust? Answer: i16, Wouldnt Smallest Be i8?

lilac holly
vapid cloak
brazen eagle
#

A couple bytes overhead is a small price to pay for proper readability

clear lodge
#

tech interview tomorrow 😬

#

the only thing I know about the role is "Vue.js, SCSS"

#

lmao

vapid cloak
brazen eagle
clear lodge
#

the other keywords were "high pressure"

#

this is very promising

#

hahaha

#

but if I get the role I'm settled not to have to do any business/sales anymore for the next 4-5 months

#

so sign me up 8)

chrome carbon
brazen eagle
#

It really does, it's like the 10x bs as well

peak cosmos
#

Someone know how to use a ListView on visual C#?

clear lodge
peak cosmos
#

When a user press "Aggiungi", the price should be added to the ListBox

clear lodge
#

You posted that question 10 mins ago, no need to bump it bera

brazen eagle
#

Have you read the docs?

#

There's probably some sample code

clear lodge
#

I think that went pretty well 🙂

#

just might get outcompeted by more experienced dev in interviews coming up but the interview was good I think

clear lodge
#

they had not really had time to look at the project I made over the weekend lmao. I put in like 12 hours a day 😄 but its cool. They appreciated it tho, haha

wooden gale
#

i want a base thing related to python can anyone help me!!

brazen eagle
#

just ask the question, please

wooden gale
#

can you please dm

brazen eagle
#

not really

wooden gale
#

i cant even put the file here

brazen eagle
#

what's the question? you may add the relevent error messages and code snippets using the code blocks (```)

wooden gale
#

i want to run a line in python file like - eg python file.py > what is the code > we typed the code > and the code wants to replace the current line and input the new line we typed

magic falcon
#

can you reword your question and example? What you're trying to do is not clear.

wooden gale
#

i want the python file to ask me what to put in number line or 11th line

magic falcon
#

of what?

#

There is no reason to DM me.

#

At least about this problem.

wooden gale
#

cuz i dont know a single thing about python'

#

if u can come dm i can sent the file and u can edit it and sent me

brazen eagle
#

we won't do your homework for you

wooden gale
#

hahah brw just fuck of

true pumice
#

Hah, homie really got upset because you wouldn't do his homework

brazen eagle
#

¯_(ツ)_/¯

wooden gale
#

yup cuz they didnt evn tell what to do ,or i think they didnt understand what i try to explain so showing the file is the better thing i think and they cant do that also

brazen eagle
#

let's not say anything we'll regret here

magic falcon
brazen eagle
#

knowing how to formulate a question clearly and concisely is an important skill to learn

wooden gale
#

sorry brw my native language is not english

#

hope you understand

brazen eagle
#

I did say you may post code snippets using code blocks

#
like so
#

but we generally don't help with homework assignments, as that's usually considered cheating

true pumice
wooden gale
#

guys plz its not campus homework and stuff

#

i trying to make a simple tool that will help me really good in future

true pumice
#

Well, once again, there is no point in taking advantage of our knowledge. You need to learn Python and do it yourself

onyx merlin
#

You will help yourself much more by learning what to do.

wooden gale
#

the tool is working perfectly good but i need it to handle more easilt like - python3 file.py > and the tool wants to ask us what is think thats put in that line

brazen eagle
#

have you looked at the docs?

wooden gale
brazen eagle
#

I think I'm starting to understand what you want, but I can't be sure

brazen eagle
#

still can't help, because I've no idea what you're actually trying to achieve

wooden gale
#

i think its related to some input flag

#

but dont know how to use it

#

its ok

#

bye

brazen eagle
#

recommend you read the docs

#

but aside from that your problem statement is really not clear

wooden gale
#

yrah its okey brw , let me try once more the AI

#

hope that gonna help me

#

we humans are full of toxic , going to over soon

brazen eagle
#

not sure how the AI will help with such a muddled question, but ok

wooden gale
#

its already helped me to give me wonderfull tool

#

i just want to makes it easy for handle

#

its a easy one but for me its really good cuz i cant study the full python language and create a tool today

tulip sail
magic falcon
brazen eagle
#

what a strange person

tall beacon
#

what have i just read lol

gentle seal
#

💀

surreal bronze
brazen eagle
vernal vigil
#

Chatgpt be really cool, i would hate if Microsoft would charge 200 bucks for 100% functionality 💀

ornate tinsel
#

Is there a way to rename a Linux file without using the rename syscall ?

inland hazel
#

hmmm

lilac holly
#

I don’t know what you mean by rename syscall

#

you can say

#

mv file.txt file1.txt

ornate tinsel
#

yes but the mv command uses the rename syscall under the hood

true pumice
wispy kestrelBOT
#

Gave +1 Rep to @true pumice

shadow pebble
#

Good day im lost here, I am doing a class Python for Cybersecurity through Cengage
not sure what operation I am missing when I get the correct answer

#

x= 3*(9 - 2) + (24/(6/3))*3 print (x)

shadow pebble
#

@true pumice

true pumice
#

@paper timber C'mon dude

paper timber
#

Its Cengage

#

Its literally a course or something

true pumice
#

And you don't think their school could have asked them to complete xyz?

#

Also giving them the answer teaches them nothing.

paper timber
#

Oh im sry 🙂

shadow pebble
#

im just confused on how i arrive at the right answer but it says i am missing an operator

#

i can put it in VB and it gives me no errors 🤷🏿‍♂️

true pumice
#

It doesn't say there was an error

brazen eagle
#

gods damnit Quarkus really works a lot better with Java

brazen eagle
true pumice
brazen eagle
#

Test is probably poorly coded though

#

These educational platforms aren't always the best

final juniper
shadow pebble
#

@final juniper the output checks out , i hate cengage its either their way or you will get an error

final juniper
#

I agree that the test should've expected that tho, but I had similar cases on codecademy ^^, it's obvious that they can't foresee any possible way to do stuff

shadow pebble
#

ok figured it out... its (3 * (9-2) + ((24 / (6 / 3)) * 3)) NotLikeThis

covert jungle
#

Hei, im currently learning about regular expressions and kinda stuck on one of the questions.
Questions: "Match all of the following filenames: ab0001, bb0000, abc1000, cba0110, c0000 (don't use a metacharacter)".

I have currently verified that this works: [abc0-1] , [abc]*[0-1]
But none of this is correct solution. Wondering if i missed some key concept and would appreciate some help.

brazen eagle
covert jungle
brazen eagle
#

Yeah but it's probably matching individual letters

#

Not the whole words

#

Think about what the question wants you to match

#

Are there any patterns you can abuse?

covert jungle
#

Yeh that make sence. I was thinking more like [abc] must be correct cause it will automatically get all the combinations.

#

but then im getting stuck on next part

#

0 and 1

brazen eagle
#

Yeah that's probably part of the regex

#

But [abc] will only match one character

#

Build up the expression step by step

covert jungle
#

For what i can see it will feks do this: " [abc] will match the string abc, but also cba and ca" . i might be wrong, but that is how i was looking at it before atleast

brazen eagle
#

[abc] will match an a, b, or c

#

You may also use a range, [a-c] will be the same

#

But you're on the right track

covert jungle
#

im so comfused, hehe

#

need to think for a while on that one

brazen eagle
#

The square brackets define a class of characters to match.

#

i.e. I want this next character to match one of those specified

#

So if you want to match more than one character with that class, you'll need to specify that

covert jungle
#

So i should use a "multiplier" like feks + or * ?

#

or as example say {0, } somehting

magic falcon
#

Throwing stuff at the wall will be way less effective and meaningful than understanding the definition of metachar, as the task suggests

brazen eagle
#

* means match zero or more of the preceding. + means match one or more

#

The task also says to not use metachars

covert jungle
#

[a-c0-1] is somehting that comes to mind

brazen eagle
#

Regexr should explain what the expression does though

covert jungle
#

but that is same pattern as before right

brazen eagle
#

Why 0-1?

#

Look at what you're expected to match, and deduce a pattern from there

covert jungle
#

Thank you so far, need to do some thinking here. Gonna read all chapters one more time

brazen eagle
#

Take notes

vapid cloak
covert jungle
# brazen eagle Take notes

Figured it out atlast!!(few hours on this one..) was not thinking like you said. It was only printing 1 combination and i had to specify how many times i want each specific pattern / combination.
Next task was a peace of cake after this one hehe

final juniper
covert jungle
brazen eagle
#

I think they're referring to * and +

#

More efficient to specify counts though, as those can be unrolled

covert jungle
#

I understand, that makes sence. Was in the world when that was not allowed, hehe

final juniper
brazen eagle
#

Yes I know there are non-greedy versions

#

The regex state machine is bonkers

magic falcon
#

look-back operators ought to be used way more often

brazen eagle
lilac holly
#

im putting

#nameInput {
text-align: center;
}

#

and its not centering it

#

I made sure its the correct id

onyx merlin
lilac holly
onyx merlin
#

It's a crucial part of css

lilac holly
onyx merlin
#

I didn't ask what it's in

lilac holly
#

with the submit button right under it

#

I dont understand what you mean by block elemnt

#

element*

onyx merlin
lilac holly
onyx merlin
#

But you said it's inside a form

#

Not that it is a form.

lilac holly
#

the form with the button and text input in it

#

nothing else

onyx merlin
#

Send code.

lilac holly
#

ok

lilac holly
#

?

onyx merlin
#

Why can't it go here?

lilac holly
#

It wont allowed me to put more characters

onyx merlin
#

Jeez, send the files...

lilac holly
#

ok

onyx merlin
#

In chat to clarify.

lilac holly
#

Alright

lilac holly
onyx merlin
#

Problem 1

lilac holly
#

is it the <title></title>?

onyx merlin
#

Ditch the commas.

onyx merlin
#

It's centered.

lilac holly
#

but still same problem

onyx merlin
#

What problem? It's centered.

lilac holly
onyx merlin
#

Works in chrome

lilac holly
#

I want it to be centered on the page

onyx merlin
lilac holly
#

Sorry

#

Im not really good at html

onyx merlin
#

I'd recommend putting some time into learning. I liked the SoloLearn CSS/HTML5 courses.

#

Personally I'd use css flex

lilac holly
#

#nameInput {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}

#

Doesn't seem to work

#

What did you do to center it?

onyx merlin
#

I learnt CSS flex

#

There's no real way of avoiding it, you're going to have to sink some proper time into learning the language

lilac holly
#

right?

onyx merlin
#

No.

lilac holly
onyx merlin
#

Honestly, you're avoiding the time sink of learning again. @lilac holly

#

If you learn for yourself and develop self-reliance, you will go far in this field

lilac holly
#

but none worked for me

#

That's why I come here to ask for help

onyx merlin
lilac holly
#

I tried this too

onyx merlin
#

Same problem

lilac holly
#

oh

onyx merlin
#

You really need to learn how it works, otherwise it's going to cause you to run into the same problem over and over.

lilac holly
#

I know how it works

#

w3schools

#

is telling me that it aligns the flex item in the middle

#

but it doesnt

onyx merlin
#

No, it doesn't. Because you are misusing flex.

#

Hence the need to learn it

lilac holly
#

Can you tell me what you did?

#

Ill still go read about it

onyx merlin
# lilac holly is telling me that it aligns the flex item in the middle

https://css-tricks.com/snippets/css/a-guide-to-flexbox/ You need to understand what a flex item is.

Our comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible properties for the parent element (the flex container) and the child elements (the flex items). It also includes history, demos, patterns, and a browser support chart.

lilac holly
onyx merlin
#

Whatever.

#

It's clear to me that every time you come here to ask for help, it's because you have not got the fundamentals down and you're running before you can walk so to speak.
When someone lets you know that, it's the same hostility. I'm not going to help you anymore.

lilac holly
# onyx merlin It's clear to me that every time you come here to ask for help, it's because you...

Crazy, how every time I ask for help about something in programming I get backfired or told to go to google when I already have looked there. I know my fundamentals in HTML and can understand it pretty well. You can't find one HTML Fundamentals Course with CSS FlexBox introduced as it is a little more advanced. Don't worry about me asking in this channel anymore. I will join another DIscord Server specifically for programming.

true pumice
wispy kestrelBOT
#

Gave +1 Rep to @harsh crystal

lilac holly
brazen eagle
#

Flex and flexbox are the same thing, which you'd know if you read the article that James posted. It's a very well written guide, I use it as my go-to reference

lilac holly
#

flex*

#

Already fixed it

#

Used margins

brazen eagle
#

Yeah except the absolute inside a relative div wreaks havoc on modern browsers and is an accessibility nightmare

brazen eagle
#

Margins are very, very unreliable

lilac holly
#

not a div

brazen eagle
#

Same difference

#

Element then

lilac holly
#

I like margin atm as im not working on a html project

#

Im making a flask project and my goal is not to make it super neat

#

But thanks for the help

brazen eagle
#

Gods I hope I never find you on my team....

#

If you're not doing an html project then you sure don't need css

lilac holly
#

So many arrogant people in this channel 😂

brazen eagle
#

There's a difference between arrogance and experience

#

If you act this way in a professional environment, I'm sorry to say you won't last very long

lilac holly
#

and call me in a way

#

trash at programming

brazen eagle
#

Because your solution doesn't hold water

lilac holly
#

Flexbox didnt work form e

#

me*

#

You are right about flexbox working for divs

brazen eagle
#

You want to centre an element, but did so in a way that'll break as soon as the window changes size

brazen eagle
#

Flexbox should work on an inner element, but it needs a containing element, which you'd know if you read the article

#

Instead you choose to ignore our advice anyways

lilac holly
#

I went to the flexbox site

#

read about it

#

tried some things

#

didnt work

#

I asked NinjaJC if he can help me

#

tells me I dont know the fundamentals

#

when all I want is just some help on how to do it

#

the rest ill do myself

brazen eagle
#

Outer div as display:flex, inner element with flex: settings

lilac holly
#

but of course you all are to arrogant to tell me because I lack "experience"

brazen eagle
#

RTFM for the details, but the site is pretty bloody clear

#

Were telling you to read, and actually read, not skim through in 5 seconds

lilac holly
#

Do I make the form first a flex container?

#

Then make the name input for example a item?

#

flex iem

#

item?

brazen eagle
#

Left side defines the container, right side the containee

brazen eagle
lilac holly
#

Whats inside right?

brazen eagle
#

Thing that goes inside the container, not really a real word I don't think

lilac holly
#

Yeah

#

I searched it on google

brazen eagle
#

It's late here and I'm tired

lilac holly
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

lilac holly
#

Your the only one that actually offers to help me

#

Sorry for calling you any bad words

#

It was not meant for you

brazen eagle
#

Shouldn't be calling anybody bad words

#

Regardless of who it's meant for

lilac holly
#

Arrogant to be specific

brazen eagle
#

Doesn't matter at this point. We want you to learn to be self-sufficient. If you have questions about specific content in the docs, that's fine, shows you're paying attention

tame willow
# lilac holly Do I make the form first a flex container?

I'll assume you're working with a div element when making a flex container. Anyway, "tagging" that div element with the defined class of container will apply its properties in the typical CSS fashion (read: exceptions apply that you need to learn). When you define display: "flex" you tell that container to use the flex system of element positioning for anything inside that div element. You can have the items ordered left to right, right to left, top to bottom, or bottom to top. And, you can have them spaced in different orientations. row is left to right, column is top to bottom. There are, reverse options too. This means that the first item to display will depnd on the orientation of your flex container. assuming it's a row (default) then the first thing to show up will be the first element you include inside that flex container; but you can specify the order direciton as is noted on the right hand side of that image.

#
<div class="container">
<div> item 1</div>
<div> item 2</div>
</div>
.container {
 display: "flex"
}

Should resolve into a couple of side-by-side phrases where item 1 is the first item (on the left). I'd highly recommend having a code editor like VSCode on yoru PC and installing an extention like LIve Server to allow you to play with learning these basic elements of web design.

#

NOTE: you'd have to either include the CSS as an import or define the CSS a <style> tag before the div element for it to render properly. It's all interpreted and rendered in order.

clear lodge
#

I'd just change 'container' to a class 'flex', as that indicates exactly what it does. 'container' doesn't really tell you anything

magic falcon
lyric mirage
remote wren
#

hello!!

you may see this post/question somewhere else but im just trying to gain info.

im doing a OSINT project too look for and analyze OSINT-frameworks and find pros and cons etc.

my question is what osint frameworks do you use and why and etc.

you can just messge me private in DM. no need to say hello etc just type what osint-framework you use and why etc.

carmine hull
#

sadly, we don't seem to have an osint channel on here

brazen eagle
lilac holly
#
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p>JavaScript can change HTML attribute values.</p>

<p>In this case JavaScript changes the value of the src (source) attribute of an image.</p>

<button onclick="document.getElementById('myImage').src='pic_bulbon.gif'">Turn on the light</button>

<img id="myImage" src="pic_bulboff.gif" style="width:100px">

<button onclick="document.getElementById('myImage').src='pic_bulboff.gif'">Turn off the light</button>

</body>
</html> ```
#

So the JavaScript doesn't need to be within a <script> element if it's onclick?

vocal oar
#

Thats right

lilac holly
#

is that because js has different elements dedicated to it?

#

kinda like how CSS uses onclick also?

vocal oar
#

ye, JS can be used outside of a <script> tag, like done in the code above where the JS is in the button element

clear lodge
#

You should try to use external scripts tho rather than inline js

#

And then import that js file

#

But this will also work 🙂

#

The same also goes for inline css. If you wanna make it super nice and proper, create an external css file 😁

peak cosmos
#

hi

#

i need help with a coding problem

#

i can't do the algorithm too c.c

wraith latch
brazen eagle
magic falcon
brazen eagle
#

also that

peak cosmos
#

nope

brazen eagle
#

still don't know what you want

#

I cannot read minds, (un)fortunately

terse token
#

Someone understand me While / do while
🛑🛑

surreal bronze
#

while True:
understood

#

could you be more specific?

wraith hearth
#

That's As Far As I Know, Anyway Forget do while D:

tulip sail
#

For example, if you need a validated user input:

#include <string>
#include <iostream>

using std::cout;
using std::cin;

int main () {
  std::string name = "";
  do {
    cout << "Please enter your name: ";
    cin >> name;
  } while (name != "Muiri");
}
#

It makes sense to get the input first before checking, then (and only then) loop

surreal bronze
#

For python, there isn't one built in so you can do something like

while True:
  print('xyz')

  if condition:
      break
tulip sail
#

Realistically do while is just syntactic sugar anyway iirc

surreal bronze
#

or..

var = None

while var is None:
  print('xyz')
  var = something

you get the idea

tulip sail
magic falcon
tulip sail
#

That was my memory of it

magic falcon
#

Yeah

#

I remember I had this argument with a couple of beginner programmers a year or so ago

tulip sail
#

Seem to remember a lecturer saying a few years back that modern C/C++ compilers tend to turn them into basically the same thing lmao

magic falcon
#

I know I've said that in this discord, too

#

really, there isn't a native code difference between most loop constructs, the exception being for (;;)

tulip sail
magic falcon
#

the reason for that is the check to exit is never evaluated, so it is technically 1 instruction faster than while (True)

tulip sail
#

Ooooh, interesting

stoic badger
magic falcon
#

It was super, super irritating from my perspective. They kept saying more and more wrong shit, without giving me a proper chance to explain why they were wrong

wraith hearth
#
i = 10
while i:
  # Do Stuff
  i -= 1

I Like This Kind Of Loop. By Like I Mean It Can Automatically End Itself And That's Kinda Cool D: (Not Cooler Then For Loop Tho)

surreal bronze
#

isn't a for loop at the base level a while loop?

lilac holly
#

If this is C, while is faster than for according to some of my sources that I dont trust completely

tulip sail
#

They're compiled to be basically the same thing 🤷‍♂️

magic falcon
#

It's plausible. But I would need to see some pretty rigid benchmarks to agree

tulip sail
#

There has gotta be an easier way to do that lmao

wraith hearth
#

(Not Cooler Then For Loop Tho)*

#

Im Just Saying Its Cool

tulip sail
#

If you're iterating over a set list of values then a while loop doesn't really make sense kekw

#

Well, not at that level

wraith hearth
#

¯_(ツ)_/¯

#
while ... : ...
tulip sail
#

Goddamnit, I knew there was an easier way to do that with range

#
for i in range(10, 0, -1):
  # do stuff
wraith hearth
#

range(10, 0, -1)

tulip sail
#

Aye

magic falcon
#

If it's python, the actual fastest way is to use a list comprehension

tulip sail
#

If it's python then why are we even talking about speed kekw

wraith hearth
#

Not Really

magic falcon
#

kek

tulip sail
surreal bronze
surreal bronze
tulip sail
#

Reading that rn

#

Why

#

Would

#

You

#

Do

#

That

wraith hearth
#

Did You Know You Could Do This In Java?

tulip sail
stone kayak
# surreal bronze https://sadh.life/post/cursed-for/

While we talk about Python loops, may I recommend the absolutely fantastic https://www.youtube.com/watch?v=Qgevy75co8c ?

What's faster, a for loop, a while loop, or something else?

We try several different ways to accomplish a looping task and discover which is fastest.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosSampleCode

SUPPORT ME ⭐

Patreon: https://pa...

▶ Play video
magic falcon
stone kayak
magic falcon
brazen eagle
brazen eagle
#

but manually unrolling is a bad idea for maintainability

wraith hearth
#

Also Lord Protect Me From Writing Java

wraith hearth
#

@brazen eagle
Holy Shiz... I Want To Quit

#

And There's More Places Where o Is Used... Why Cant People Name Variables

brazen eagle
#

Naming Variables, Cache Eviction, and Off-by-one errors

wraith hearth
#

And Best Thing Is NO COMMENTS OR DOCSTRING

#

I Want To Cry

brazen eagle
#

clearly oo is an object object

true pumice
#

Too vague smh

dusk fractal
#

hi

surreal bronze
#

Hi :)

wraith hearth
#

Worst Part Is I Have To Make Docstrings For It D: Me, A Clueless Individual (About What Methods Do)

tame willow
# wraith hearth <@186470389604548608> Holy Shiz... I Want To Quit

Reminds me of a contractor I've convinced my boss needs to be, uh, un-contracted. He'd have forms that have very explicit purpose such as name, and email. And, he'd just like label them all f1 and f2 in this fairly enormous React components. Not to mention the fact that everything he wrote took 10x longer than it should, and had to be completely re-written o_0

brazen eagle
#

oof

timber fable
#

hello, I need resources for python scripting actual (optimal) tools for penetration testing, like actual shit similar to john the ripper, hydra, nmap or whatever well-known tool, as I can't find any serious resources in the internet

hollow sorrel
lilac holly
#

can anyone help me? I'm trying to send input (mouse click) to Microsoft Store app in Windows in the background without giving focus to the app and i cannot get it to work, any ideas?

#

i'm using a ui automation library (which wraps the Windows.Automation client COM) which successfully grabs the specific ui element, but using PostMessage on it doesn't work, only SendInput with focus

surreal bronze
#

Remembering, your sending mouse clicks - if you normally click it with the mouse it'll obviously focus it.

#

Why?

lilac holly
#

Yeah, that's what i'm trying to prevent

#

i thought about hooking the window procedure (WH_CALLWNDPROC) and changing the style of the popup window that is being created

#

i wrote a .dll in lazarus and the installer in c#

#

the hook .dll is a native .dll in free pascal

paper timber
#

Anybody have any idea how to extract the "text" variable from the below output ?:

paper timber
# paper timber Anybody have any idea how to extract the "text" variable from the below output ?...
[<OpenAIObject at 0x7f180fe5d8b0> JSON: { 
"finish_reason": "stop",
"index": 0, 
"logprobs": null,
"text": "example TEXT 1 generated"
 <OpenAIObject at 0x7f180fe5df40> JSON: {
"finish_reason": "stop",
 "index": 1,
"text": "example TEXT 2 generated"
, <OpenAIObject at 0x7f180fe74360> JSON: {
"logprobs": null,
"finish_reason": "stop", 14 
"index": 2,
"logprobs": null,
"text": "example TEXT 3 generated"
}] 
lilac holly
#

using SetWindowsHookEx

#

i tried many things

#

i feel kind of lost

surreal bronze
lilac holly
#

are you sure? there isn't some sort of a "hack" we can pull on it?

#

i'm pretty sure if we subclass the window procedure and handle the "CREATE WINDOW" message we could do something no?

#

it can be easily ui automated, but

surreal bronze
#

unless you were to RE the Microsoft app store and work out whats called for each specific event and then somehow inject into it and call it directly which I dont even think is possible then no, not possible afaik.

lilac holly
#

i want to prevent the window from coming to the foreground

#

there's no need to RE the app, i can monitor the WND PROC

#

for that specific event

#

window message

north wave
#

greatings

lilac holly
#

greetings

surreal bronze
#

yes, and as I said before your sending mouse click events

lilac holly
#

oh shit yeah

surreal bronze
#

which, of course, will focus the window

lilac holly
#

that's what's causing it to go on top

#

yeah..

surreal bronze
#

because thats how the OS deals with it

lilac holly
#

damn

#

there gotta be a way...

#

jeez..

surreal bronze
paper timber
wispy kestrelBOT
#

Gave +1 Rep to @surreal bronze

surreal bronze
loud vector
#

Anyone keen on Java and want to help a fella out?

timber fable
lilac holly
#

Guys help me 🙏🙏🙏🙏

surreal bronze
#

there is no way

lilac holly
#

Nothing? At all?

surreal bronze
#

nill

lilac holly
#

nill?

#

what's that supposed to mean

#

i just downloaded x64dbg to try and RE the binary

surreal bronze
#

nill = none = nothing

lilac holly
#

i see..

surreal bronze
#

yup, goodluck

#

oops that should be spelt with 1 l

#

nil*

inland hazel
#

@surreal bronze difference between nill and null.... thank you in advance

wispy kestrelBOT
#

Gave +1 Rep to @surreal bronze

brazen eagle
loud vector
#

it's not a py, its a java class. it is nesting the strings in a bracket every time it reads or writes

#

I wish we were using python for this project

lilac holly
#

another question

#

how can i run Microsoft store twice? or even more?

#

more than one instance

#

i see that

#

Windows 11 has a launcher called "SystemUWPLauncher.exe" that spawns the Win.Store.app.exe

#

They're using mutex

#

but i'm not sure which one is the right one

#

or... idk

loud vector
#

you know what I will see if there is a java discord somewhere out there in discordland

lilac holly
#

so many hackers here and no one can help me with

  • Run MS Store app with multiple instances
  • Click the "buy gift" button without the app coming to foreground
#

there must be something could be done

vestal carbon
#

I think @true pumice that js is my next project

true pumice
#

Holy shit that's insane

true pumice
#

Like without them knowing I mean

lilac holly
#

No, it's for one of my clients

#

I have no idea what's his intention

#

It's a paid project

true pumice
#

Oh I see

lilac holly
#

I'm doing it for the review (5 stars)

true pumice
#

Your client seems really smart for trying to hire you

lilac holly
#

the budget is low but he is willing to go higher

#

lol

true pumice
#

When you clearly don't know much

lilac holly
#

thanks for the "compliment" 🙂

#

XD

true pumice
#

It wasn't a compliment

#

I was insulting you xoxo

lilac holly
#

i'm not a serious hacker, i know a little but not much. i'm an expert in automation (desktop and web) and in bots/chatbots

#

that's why i sorrounded the word compliment with ""

modest basinBOT
#

:hammer: tzi02723#5689 has been banned.

vestal carbon
#

Tried to be discreet with it 😅

onyx merlin
#

expert in automatuin
how do I automate this
We have different definitions

inland hazel
#

shadow is an expert in stubbing their toes on small door frames

true pumice
#

I don't know their intentions
I'm not a serious hacker

Seems like they need a lesson on ethics

timber fable
#

Is it better to program a multi purpose pen testing tool in C/C++ or python?

vapid cloak
# timber fable Is it better to program a multi purpose pen testing tool in C/C++ or python?

Python will be easier but with slower execution speed and may not give you access to the low level resources you may need for some tools. C will be very difficult, require a lot of code and careful memory management, but will give you more direct access to hardware and execute quickly. C++ is kind of a middle ground. You’ll have access to advanced high level language features but still have low level access to memory and hardware. Execution speed will also be faster than python. It really depends. If you’re just getting started, I recommend python. Once you’re proficient, only use C/C++ if necessary. Those are my insights and recommendations.

inland hazel
#

also the difference between compiled and interpreted languages

#

compiled like c and c++ means you need to compile the code every time you make a change to run it

#

while for python or ruby or lua you can run it directly after the change without waiting on the compile

timber fable
wispy kestrelBOT
#

Gave +1 Rep to @vapid cloak

vapid cloak
timber fable
inland hazel
#

depends on the hashing algo

timber fable
inland hazel
#

sha1 md5 and ntlm sure

#

sha512 not so much

#

if shadow recalls correctly

magic falcon
inland hazel
#

the change here is that some of the older hashes are a lot less resource intensive compared to newer ones today.... but yeah juun is right

timber fable
magic falcon
#

unless you are making tools because you think there is a gap in what the current 'best practice' tools do, you are better off just using the standard tools, when you can

magic falcon
timber fable
#

Well honestly I am doing it for fun, to gain experience, and to prove my scripting skills and make projects to get a decent internship. And if I am lucky enough maybe it goes viral

inland hazel
#

well so far it is basicly only jumbo john and hashcat for offline password cracking

timber fable
magic falcon
timber fable
magic falcon
#

And the sooner you figure out TDD And BDD if you don't know them, is to your benefit.

inland hazel
#

heard of TDD did not recognise BDD in an instant but figured it out inside of 5-10 sec

marble crescent
#

Does the rule no help with homework also work here? Cuz i can maybe ask some questions soon but it is homework lol

#

Its isnt an exam and wont get assessed, its only practice for us atm

lyric mirage
#

Sadly, yes.

#

But i'm not a mod.

marble crescent
#

Fair enough, stack overflow it will be

#

Haha

brazen eagle
#

TDD is useful, though requires discipline.

#

BDD is much harder to go at it alone

brazen eagle
inland hazel
brazen eagle
#

if you think it isn't, then you have a design issue

inland hazel
#

the key words here were not easily

#

impossible is a whole other thingy

brazen eagle
#

you can always break down the spec

#

you'll generally want to focus on behaviour type code in TDD, but necessarily UI code

#

though in theory you can automate the UI tests as well

marble crescent
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

serene viper
#

hey all, good night. Does anyone know if there's a way to run C code using the windows api (windows.h) with WINE in linux ?

context if anyone cares: my OS teacher in college is going to teach system calls in C in windows, and i use linux, and i my computer is not that powerful to handle a VM just to code in C, and i really don't wanna have to install windows (i only have one drive, and i really want to not have to dual boot if possible)

magic falcon
brazen eagle
#

depends on the techno and the language, but yeah

#

though I'd expect Unity and Unreal to have something

magic falcon
#

they don't really do unit testing though, from what i remember

#

i bet there is a C# or unreal-script plugin for unit testing components though

brazen eagle
#

can probably use NUnit or something for C#

#

at least I think it's N, haven't used C# in forever

magic falcon
#

that's a unit test framework, right? turns out unity has it's own test runner, not sure if it has all the machinery to fully mock UI elements

brazen eagle
#

ye

brazen eagle
bronze mist
#

I need to update text not clamp it

#

Source code:

#
import pygame
from pygame_button import Button
pygame.init()

count = 0

setup = {
    "clicked_color": (255, 0, 0)
}

def game():
    global setup
    def update():
        text = font.render(f"Count: {count}", True, (0, 0, 0))
    
    butt = Button((0, 0, 200, 50), (0, 0, 255), count, text = "Click!", **setup)
    screen = pygame.display.set_mode((700, 600))
    font = pygame.font.SysFont("Comic Sans MS", 24)
    text = font.render(f"Count: {count}", True, (0, 0, 0))
    text_needed = text.get_rect()

    butt.rect.center = (700 // 2, 600 // 2)
    text_needed.center = (700 // 2, 600 // 3)

    while True:
        screen.fill((255, 255, 255))
        screen.blit(text, text_needed)
        butt.update(screen)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:  
                pygame.quit()
                quit()

            butt.check_event(event)
            pygame.display.update()


butt = Button((0, 0, 200, 50), (0, 0, 0), game, text = "Start", **setup)
butt.rect.center = (700 // 2, 600 // 2)

screen = pygame.display.set_mode((700, 600))
font = pygame.font.SysFont("Comic Sans MS", 45)
text = font.render("GameLol", True, (0, 0, 0))
text_needed = text.get_rect()

text_needed.center = (700 // 2, 600 // 3)

while True:
    screen.fill((255, 255, 255))
    screen.blit(text, text_needed)
    butt.update(screen)

    for event in pygame.event.get():  
        if event.type == pygame.QUIT:  
            pygame.quit()
            quit()

        butt.check_event(event)
        
        pygame.display.update()
brazen eagle
#

maybe I'm missing something, but I'm not seeing how game() is called

bronze mist
brazen eagle
#

can you elaborate what you mean by clamped?

brazen eagle
tame willow
# serene viper hey all, good night. Does anyone know if there's a way to run C code using the w...

System calls in Windows :/ Time to protest.

With that, my suggestion would be to just make a VirtualBox install of an older version of windows. Setup an SSH server on your windows install. Expose all relevant ports. Then when you start the instance you can run it “headless” and use VSCodes remote connection feature to connect to the headless VM via SSH. This will reduce the workload on your host machine and still give you access to windows from Linux.

Alternatively, get cloud time on a windows VM from AWS, Google, etc. you can remote connect the same way via VSCode.

stone kayak
#
  broker:
    image: docker.io/library/redis:7
    restart: unless-stopped
    volumes:
      - redisdata:/data

Is redisdata supposed to be mapped to my machine as /redisdata? I can't find it 🤔

stoic badger
#

I believe it's trying to mount to a volume named redisdata instead of mounting to a specific folder

#
  broker:
    image: docker.io/library/redis:7
    restart: unless-stopped
    volumes:
      - /redisdata:/data

I think this would work, but it's been a minute since I've used docker compose and volumes

brazen eagle
#

yeah it's a volume, so managed by docker itself

timber fable
#

Hello,I want to manually manage argparse exception handling, so that my script doesn't exist when encountering an error and simply recalls the parent function and repeats everything from the start. But I can't find the exception/error for when the user types something totally invalid as an argument ( like instead of "-t xyz" they do "sthrandom" with no -t). That produces an error different from ArgumentError or ArgumentTypeError, so I can't except it, I tried the global except: , but that wasn't enough as I need some way to refresh argparser and remove any leftover random stuff in the arguments. I hope I explained the problem clearly.

stone kayak
stone kayak
#

there is significant metadata in redis i cannot lose and i am trying to back up 😄

#

ah i believe docker volume ls docker volume inspect gets me the path

brazen eagle
#

Yeah but volumes are handled by docker itself

#

The layout is not really standard

tulip sail
#

You would effectively end up with two "drives" containing redis data, one at /, the other at the path where docker stores volumes (can't remember -- /var/lib/docker/volumes, maybe?)

tulip sail
#

Either way you ain't going to be grabbing the data that way kekw

brazen eagle
#

docker-managed volumes are pretty opaque

tulip sail
#

Obviously local docker, swarm would be rather different

brazen eagle
#

generally use docker volumes

tulip sail
#

How are you handling redundancy and backups?

brazen eagle
#

I mean for proper persistence you'd probably need to use a PVC or something from your orchestrator

#

most of my local stuff is disposable

tulip sail
#

Interesting chceyes
I really need to go do some Kubernetes

brazen eagle
#

probably bind to an OS path if you need to be able to view it outside the container

#

or if you're using a DB, I suppose

tulip sail
#

Yeah, that's the conundrum

brazen eagle
#

I use RO mounts for config files that need to be version controlled

#

think you can import/export volumes though

#

at least podman does

magic falcon
brazen eagle
#

docker has volumes, dunno what swarm uses

magic falcon
#

but a regular docker volume mount is ephemeral

tulip sail
brazen eagle
#

that's why I'm saying it's mostly disposable

magic falcon
#

@stone kayak You could try creating another container configured to allow you to exfil that volume data, but it's going to be messy in best case

lilac holly
#

I googled the issue, couldnt find satisfactory answer.

I am looking for C code profiler to tell me wheres a bottleneck in my code. To be more precise I am looking for it to be online and simple so much that all I need to do is give it my .C file and it will do the rest

magic falcon
#

You are going to be better off using a profiler compatible with your current toolchain

#

as loathe as I am to give credit to MS for anything, I think they have a really nice built in profiler for visual studio

idle chasm
#

Hello. Please does any one spam here. I need to grow my company. Thanks

idle chasm
#

yeah i need a good spammer who spam for office 365 and personal domain . do you do that please advise ?

idle chasm
true pumice
#

Like email spammer?

idle chasm
modest basinBOT
#

:hammer: williams50#5246 has been banned.

idle fulcrum
#

This was very satisfying to read and I love the ending. 10/10.

brazen eagle
#

Eh, predictable, 6.5/10

brazen eagle
#

boooo...the crypto library I'm using fixed the JVM bug I wanted to exploit 😦

whole yacht
#

psyDuck how could they

surreal bronze
#

~~#1 rule - never update libraries ~~

brazen eagle
#

the standard DER ASN.1 encoding returns as invalid

#

ugh probably because it wants a raw string

magic falcon
#

or a reference to the actual canonical String object?

brazen eagle
#

I mean a p1363 encoded signature

#

it's signing find if I generate it properly, but I'm trying to get it to validate a psychic signature

magic falcon
#

isn't that vuln one of the reasons ECC is discouraged?

brazen eagle
#

yes

#

(is for a room)

#

but I think I'll need to find an alternative way to forge this

#

too bad, it was a cute bug

#

or I can try using spring boot I guess

surreal bronze
#

Do you not have older copies or does it auto update?

brazen eagle
#

I set an older version of the dependency, and am normally on a vulnerable JVM

#

the POC'd value seems to not work

magic falcon
#

interesting article I found on this problem

brazen eagle
#

that's the one

brazen eagle
magic falcon
brazen eagle
#

Checked the code, the version I have doesn't have the check. But it appears to be crashing earlier when it tries to convert to the ASN.1 format

#

ah damn their implementation is flawed

brazen eagle
#

ok that required some arm-twisting....

#

so umm, hacky code is hacky

#

Gods why is intentionally breaking something so difficult?

magic falcon
#

Shift left works?

brazen eagle
#

Also I think the library had an inadvertent bug that improved security

#

It was converting my A's to 0x300402000200 instead of 0x3006020100020100

eternal fern
#

Can any body tell me resources to learn bash for free

swift condor
#

@lilac holly Here please 🙂

lilac holly
swift condor
#

Can you share the full code snippet here please?
What is the goal of this variable? What error message are you getting? Did you search for that error message online?

true pumice
#

That's such a big OR chain aa

lilac holly
#

Everything is working

true pumice
#

So

#

You need to set flags throughout your program

#

Random print statements that show you how your program flows

#

But you're also misusing if statements

#

You can't say if var == 'a' or 'b', you have to say if var == 'a' or var == 'b'

#

@lilac holly

brazen eagle
#

I'm pretty sure there's a library function to tell you if something is numeric or not

magic falcon
#

There is

true pumice
#

int() will raise an error

magic falcon
#

There are multiple libs that have that check, for different purposes

brazen eagle
#

Yeah but something like isNumeric or isAlpha

#

Not super familiar with python though

true pumice
#
try:
  int(num)
else:
  print("Your variable is not a number")

You can use isinstance() or type() but there's issues with them detecting the wrong data type because Python

brazen eagle
#

I mean if you're just going to throw an error for using letters, then throw a generic error saying you need integers instead of checking each case explicitly

#

Try else for exception handling in Python?

#

Also the original code will break past 10

#

But not knowing the spec, this may or may not be an issue

true pumice
#

WHOOPS I meant try except

#

am tired

brazen eagle
#

Yeah ok that makes sense

magic falcon
#

if you can't use a lib for some reason, it's always always better to convert the letter to the ordinal value and do a bounds check for your range

brazen eagle
#

Yeah but that'll convert to the ASCII range for the character, yes? Well, UTF-8 more likely

magic falcon
#

there's still an ordinal value; the encoding shouldn't matter, regardless of ASCII, LATIN-1, or UTF-N

#

IIRC ord() gets the ordinal within the encoding set

wraith latch
# lilac holly Why is that

Because of the syntax that Python expects. The Or statement lets you combine multiple condition statements, so you need to write it that way because python will only accept it in the form of if var is equal to 'a' or var is equal to 'b'

true pumice
wraith latch
#

As @true pumice just mentioned, otherwise the 'other' statement will return true. Because you want it to check if this, or that, or the other, etc.

lilac holly
#

I had to write all the alphabet

#

Any easy way

true pumice
#

Yes

#

You can set the alphabet as a list and then iterate over the list

lilac holly
true pumice
#

Mhm, but, unless you want to import an outside module, you will have to write in manually

true pumice
#

Google "import alphabet Python"

lilac holly
#

Oh and the functions name.

magic falcon
surreal bronze
#

n.__index__

eternal fern
#

Hey i have a problam i have a raspberry pi 3 i install kali linux on it but after booting it screen blinking also i unable to change its resolution

magic falcon
# surreal bronze `n.__index__`

by convention, methods, instance objects, and class objects that start with __ are intended to be private - usage of those items directly is not recommended, as it may have side effects on other operations later on

surreal bronze
#

True 🤷‍♂️

timber fable
#

I need some ideas for pentesting features or tasks I will implement in my mutlipurpose cybersecrurity tool (python)

midnight marsh
#

Hi guys, I made this script.

This script uses the technique of brute force in URLs to discover directories through the list of words, like gobuster or ffuf.

brazen eagle
#

you have a lot of repeated blocks of code, consider refactoring those

hybrid cypress
#

Hello (im new here so if this is the wrong chat for this question pls let me know and Ill delete my question and go to the recommended chat) , What is the best way to learning programming in your opinions, ive got a bit of IT experience but ive never really gotten into programming and I have realized that Im going to need to get good at that.

#

checked pinned AHHH well, if anyone has any other recommendations?

magic falcon
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

magic falcon
timber fable
#

should I use setuptools for a tool made for linux? Or there is a better way to make an installation for my tool on linux?

inland hazel
#

oh boy is that a rabbit hole

timber fable
surreal bronze
#

So compile it into a binary executable

#

Then add it in your PATH

#

Or just add a shebang and chmod+x

#

Then add that to path

#

But eh that presumes the user has python on their system at that path

#

Which if it's Linux, most likely is

hollow sorrel
#

a symlink works also, no ?

#

or create an alias for it

surreal bronze
#

You'd still need to add the symlink to a directory in PATH

#

Alias sure that works too

brazen eagle
#

You could also in theory package it

#

But that may be painful

timber fable
#

thanks

timber fable
#

I finally published the first release

#

what do you think?

brazen eagle
#

why does everyone fall into the same trap...

#

so first of all, please include a readme showing how to use the tool

#

second, I'm not at all sure how the command line arguments you specified are meant to be input

#

oh gods I just saw, and wow that's a hack... not the most intuitive way to ask for parameters

#

I'd prefer to see a collection of standalone utilities rather than a menu

#

one thing on the ssh bruteforcer, if you throw as many threads as username-password combos then you'll break either the client or the server

timber fable
timber fable
timber fable
#

and I'll fix that bruteforce issue ig

#

thanks

surreal bronze
#

Oh blimey

#

Okay, firstly - if you really want to go forward with this I'd suggest making a pypi package using https://python-poetry.org/ also, for taking arguments I'd suggest using https://click.palletsprojects.com/en/8.1.x/

Users don't want to have to run the tool, then give input to a menu - it's long, ineffective and not good for incorporating it into scripts. Also, consider not using a banner for accessibility - it rather clogs up the terminal and again, isn't necessary (see https://skerritt.blog/making-hacking-accessible/). In this case, less is more. Also consider cleaning up your readme more (see https://skerritt.blog/make-popular-open-source-projects/ for some tips), I don't think having a massive Todo list on there is entirely helpful

Also, please use a library like https://github.com/Textualize/rich for printing instead of using these ugly escape sequences.

In terms of the file structure, as mentioned earlier I'd suggest using poetry and making it into a package (with main and init) instead of using setuptools which iirc is quite old and rarely used now a days

Again, using something like click or argparse will avoid you having to use an extremely hacky ugly solution like this

Skerritt.blog

Introduction

I have around ~10k GitHub stars. I’ve come up with a bullet-pointed actionable list of how to make open-source projects popular.

One of the projects I created had 67 lines of code and had only existed for 3 days before it hit 1.7k stars.

Humans are predictable

GitHub

Rich is a Python library for rich text and beautiful formatting in the terminal. - GitHub - Textualize/rich: Rich is a Python library for rich text and beautiful formatting in the terminal.

#
poetry init 
poetry build
poetry publish
#

For cleaning up your code

#

I can see a lot of code that's been repeated (functions too) , flake8 should deal with thoes

magic falcon
#

flake also won't remediate those problems, just make you aware of them

surreal bronze
#

Ah, maybe I'm getting mixed up with another tool

magic falcon
#

black will reformat though, but I've had problems running it against code i didn't write

#

namely, the tab-equivalent spacing sometimes messes up

#

that said, i still recommend both

surreal bronze
#

I can also see your defining a function within a while loop so that'll do that in every iteration of it .

You've done an extremely hacky solution for getting input from the user, from what I've seen at least a third of all your code is just managing that. By using something like click and not a menu, I reckon you'll be able to make a good chunk of all that redundant and hopefully minimise / clean the whole code up a bit

surreal bronze
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

surreal bronze
#

cc @stone kayak has a lot of experience with making open source hacking tools (and certainly helped me out a ton with making mine) so maybe they'll be able to give some advice too 🙂

#

Anyways, wish you the best and gl with the project, if you have any follow up questions fire away

tulip sail
#

Oh, Jesus Christ. Forget the possibility of breaking stuff with the threads, even if it did work, the thread startup costs would be insane, and you won't get any performance benefits anyway given you are limited to the number of logical cores available.

#

I.e. you waste a tonne of resources on making thousands of threads, almost certainly break something in the process, and can't even run them simultaneously anyway 🤷‍♂️

#

Thousands of threads between 16 logical cores is still just 16 concurrently. The rest is context switching. How intensive do you think context switching between thousands of threads is gonna be lmao

magic falcon
tulip sail
#

This is true ask me how I know

magic falcon
#

kek

timber fable
# surreal bronze Okay, firstly - if you really want to go forward with this I'd suggest making a ...

I really appreciate your help mate! Thanks for the insights!
I'll look into all these links and suggestions further and see what I can change, and what would be better.
But I got a few things to say about how and why I structured the tool this way:
The reason I thought of a menu, is because I didn't want to make'em separate standalone scripts that run and do their jobs by themselves. Because from my pov, the only reason that would make any people use this tool is that it's all stuffed in one place and easy to understand/grab, if they were separate in any way and you had to use them as if they were them own tool, then why don't you just search for the single best tool for every functionality you would need instead of using this random stuff. I say this because I know I didn't come up with anything new, and that I my current level it's pretty hard to outperform any single tool in it's main functionality, so I'll just stuff everything together and make the tool look like it can do a lot of things. I want people to psychologically rate the tool as whole chunk, instead of rating every functionality on it's own, because I did most them in a pretty trash way and I am working on making them better.

wispy kestrelBOT
#

Gave +1 Rep to @surreal bronze

surreal bronze
#

I understand, but instead of doing an interactive menu that takes time and is inefficient, why not have something like

ktool --file-download xyz
ktool --ssh-brute xyz
ktool --info-gather xyz
#

It means that you can easily run the command, let it do it's thing and then come back to it when it's finished

#

Instead of having to wait for the prompt to show up, then manually enter the option you want

#

Do you see what I mean?

timber fable
# surreal bronze Instead of having to wait for the prompt to show up, then manually enter the opt...

I don't think the prompt takes much time to show up like metasploit does. Besides, maybe people will get used to it and it becomes faster and more intuitive to use? I'll put the same option for going back (maybe number 77), and If it were the first time for me using the tool it would be easier to follow a menu (max: 3 steps) instead of reading the README.md and searching for how to use the tool.
But yeah the way you mentioned makes sense too and I'll check on more tools using the menu system and see how well they are performing and how easy it is to use them.

timber fable
surreal bronze
#

ktool --help for a help menu

surreal bronze
#

Hydra, fexobuster, gobuster, ciphey, ffuf, nmap, you name it

magic falcon
#

They follow that format because that is the unix development guide's reccomendation.

#

If you want to develop a tool that is more likely to be picked up by the communities, separate functionality from interactive mode.

timber fable
#

This will force me to look for much more optimal solutions, and maybe remake what whole tools do just because I added (and still wanna add) more options. It can really get out of the scope of this being a simple personal project yell_cat

brazen eagle
#

Also having proper library code for the tools may help if one wanted to integrate them with their own ui

#

Don't forget unit tests if possible, and try to keep your code DRY

inland hazel
brazen eagle
#

Dry meaning "Don't Repeat Yourself", within reason of course

magic falcon
#

There are very few exceptions, of course. Building factories to implement a UI functionality as a prototype typically involves a stupid amount of duplication of UI element code, as diagnosing specific element problems can be really really difficult if implemented generically. (Looking at you, JavaFX)

brazen eagle
magic falcon
brazen eagle
#

that sounds about right for uni work

timber fable
#

I think this is very similar to how I thought

#

all in one thing vs does one thing

#

and does that well

brazen eagle
#

Last part is key

magic falcon
#

Again, go read the Unix Developer Guide.

timber fable
#

I'll check it out

magic falcon
#

That's a guideline document for a specific company. There is at least 1 actual book that is a really good investment if you plan on making tools.

timber fable
#

ok

floral bone
#

Hello,
Can anybody tell me why the def start() always gives me an error on the code that comes after it?

name = input("Hello, welcome to this simulation. First, I need to know your name. ")
print("Hello", name ,"my name is Jack, and I am your host today.")

mood_success = False
def start():
mood = input("Secondly, tell me your mood. ")
if mood == ["sad", "happy"]:
    mood_success = True
if mood == "sad":
    sad_mood = input("I am sorry you're feeling sad. Is there anything I can do to fix it?")
    if sad_mood == "yes":
        input("Great! What can I do?")
    if sad_mood == "no":
        print("Aww...")
else:
    print("I'm sorry, just tell me your mood and nothing else.")

start()
  File "C:\Users\****\Desktop\python\Test\main.py", line 6
    mood = input("Secondly, tell me your mood. ")
#

If I move def start(): to anywhere else, say above a if statement, it will say that if statement under the function has an error.

#

I'm trying to make it restart from the mood = part if the user puts in anything other than just the mood.

lilac holly
#

it works fine if u indent it all

#
name = input("Hello, welcome to this simulation. First, I need to know your name. ")
print("Hello", name ,"my name is Jack, and I am your host today.")

mood_success = False
def start():
    mood = input("Secondly, tell me your mood. ")
    if mood == ["sad", "happy"]:
        mood_success = True
    if mood == "sad":
        sad_mood = input("I am sorry you're feeling sad. Is there anything I can do to fix it?")
        if sad_mood == "yes":
            input("Great! What can I do?")
        if sad_mood == "no":
            print("Aww...")
    else:
        print("I'm sorry, just tell me your mood and nothing else.")

start()
lilac holly
#
name = input("Hello, welcome to this simulation. First, I need to know your name. ")
print("Hello", name ,"my name is Jack, and I am your host today.")
mood = input("Secondly, tell me your mood. ")
    
mood_success = False
def start():
    global mood
    
    if mood == ["sad", "happy"]:
        mood_success = True
    
    if mood == "sad":
        sad_mood = input("I am sorry you're feeling sad. Is there anything I can do to fix it?")
        if sad_mood == "yes":
            input("Great! What can I do?")
        if sad_mood == "no":
            print("Aww...")
    
    elif mood == "happy":
        print("I'm happy you're happy! :)")
        
    else:
        print("I'm sorry, just tell me your mood and nothing else.")
        mood = input()
        start()

start()
#

i think this is what ur looking for

floral bone
#

What's the global mood?

lilac holly
#

it makes the mood variable accessible to all scopes

#

without it, you wouldn't be able to set the mood to something else at the end cause it's outside the function's scope

#

without it you'd get an error like this

floral bone
#

Oh okay, so it makes it available for changes?

lilac holly
#

yee

floral bone
#

If I entered hey im sad at the start, and then later would add "sad" it would come up as "hey im sad sad", or not show up at all?

but with the global variable it would reset the variable and only add the "sad"?

lilac holly
#

nah its for the mood not the name

#

there's no code interacting with the name variable so nothin weird would happen

#

do u know about scopes sxdtune?

floral bone
#

I meant the mood

floral bone
#

Im really, really new to coding

lilac holly
#

it's all good

#

really really important thing to know

lilac holly
floral bone
#

This happens:

Hello, welcome to this simulation. First, I need to know your name. Alex
Hello Alex my name is Jack, and I am your host today.
Secondly, tell me your mood. sad
I'm sorry, just tell me your mood and nothing else.
#

When I send "sad" it gives me the error, but when I send Happy it goes forward

#
name = input("Hello, welcome to this simulation. First, I need to know your name. ")
print("Hello", name ,"my name is Jack, and I am your host today.")
mood = input("Secondly, tell me your mood. ")
    
def start():
    global mood
    
    if mood == ["sad", "happy"]:
    
        if mood == "sad":
                sad_mood = input("I am sorry you're feeling sad. Is there anything I can do to fix it?")
        if sad_mood == "yes":
            input("Great! What can I do?")
        if sad_mood == "no":
            print("Aww...")
    
        if mood == "happy":
            print("I'm happy you're happy! :)")
        
    else:
        print("I'm sorry, just tell me your mood and nothing else.")
        mood = input()
        start()

start()
#

Ah

#

Found it

#

I had tabbed one time too much at "sad_mood ="

#

Oh wait no

#

Im stupid

#

Same error

#

Maybe It's because I've added multiple if statements in one?

lilac holly
#

nah

#

it's cause it's all wrapped inside this one line

#

if mood == ["sad", "happy"]:

#

so it's checking if mood is equal to a list, with elements "sad" and "happy"

#

if u get rid of that and indent the rest of the code properly it should work

#
name = input("Hello, welcome to this simulation. First, I need to know your name. ")
print("Hello", name ,"my name is Jack, and I am your host today.")
mood = input("Secondly, tell me your mood. ")
    
def start():
    global mood
    
    if mood == "sad":
        sad_mood = input("I am sorry you're feeling sad. Is there anything I can do to fix it?")
        
        if sad_mood == "yes":
            input("Great! What can I do?")
        if sad_mood == "no":
            print("Aww...")

    if mood == "happy":
        print("I'm happy you're happy! :)")
        
    else:
        print("I'm sorry, just tell me your mood and nothing else.")
        mood = input()
        start()

start()
floral bone
#

And it only works on happy because its at the end of the list?

wispy kestrelBOT
#

Gave +1 Rep to @tender pewter

lilac holly
#

<3

lilac holly
#

but if you get rid of a tab so that it's outside of that if mood = list then yea it'd work