#programming
1 messages · Page 5 of 1
as the crates ecosystem and dependency management in Rust in extremely easy, it can get away with std library being minimal!
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 […]
It claims it doesn't, but lifecycle behavior of variables once it has left scope doesn't clean up memory the way I would expect. Behavior of memory cleanup, even using drop, looks an awful lot like how Java handles GC.
what's the way you expect? It does clear up memory, otherwise it will be memory leak. Also, can u provide a example as well
compile with debug, throw a breakpoint after the drop. Do a memory dump of the process, memory is still marked as allocated and active and contains the data
are you sure that breakpoint is after drop has executed?
Does drop have some sort of undocumented built-in async functionality?
? don't think so
https://doc.rust-lang.org/std/mem/fn.drop.html you can also explicitly drop a value
Disposes of a value.
Java does reference counting IIRC
but the GC is pretty magic
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
yeah, hence the magic
well, Ok, it'll try to run the GC when it get a lull in the cpu
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
at least the recent versions aren't too heavily impacted perf-wise by the GC
yeah not sure what rust's memory model is. It doesn't have a runtime, so there may be reference counting, but it's not quite like java's GC
It's supposed to be strictly scoped, but when destructors get called doesn't seem to reflect properly in a memory dump of the paused executable
yeah but I'm assuming it's still deterministic
It ought to be, I agree
arg why is my ssh not working...bloody kickstart
kek, did you give it the right pubkey?
yeah but I'm being a bit dumb
gave it the right pubkey but I may not have put it in the right place
i always screw up kickstarts as well
it's a bit wierd because it mounts the disk and seems to do a chroot in post
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
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
waiting after AL2022
for sure fedora is
CentOS 8 Stream is on 4.18
so I don't think RHEL8 is
CentOS 9-Stream doesn't import
f37 as well
oh, you're right. RHEL8 is 4.18
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?
Run a virtual machine; postgresql, mysql, maria are all very easy to install on linux.
I don't have access or time to install vms on school computers.
Can you install a VM on your personal computer? A properly set up school network will not allow you to run programs from a USB drive.
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.
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
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.
There is league of legends and cs 1.6 on almost every computer. I don't think there is any policy on usb drives.
Learn the policy. The games may be approved, but bringing unapproved software in could be bad for you. Talk to the IT team and learn what the policy is.
Maybe they have a golden image to rebuild all PC when stuff goes wrong 😂
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.
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 😂
there is xampp which is an all in one package with database etc. can just be installed and run
they're easily containerized as well
Even on windows! Even if podman wants to use WSL as the backend for some reason
I mean it's easier than hyper-v
docker uses WSL as a backend as well
If I could configure podman on windows to use hyperv I would give it a try - same with using another hypervisor backend
still need a kernel backing the containers
does it? that makes me kind of sick, after using docker, podman, lxc on centos for so long
I mean it's all cgroups and namespace magic anyways
that's true; i'm more irritated at the lack of virt options for containers on windows
docker has windows containers
yeah
but yeah I've never used them
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
Yeah
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
const names = await response.json();
how can I check if the response is empty
Yup
response.text gives nothing
eh, change it to http with a different site and it worked
Oh PowerShell aliases curl to invoke-webrequest
yh
I need to code a ROT13 decoder in js
for an assignment?
no, for a project
what kind of project?
There should be plenty of resources online. Break it down in small chunks what needs to be done and research for it.
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.
This should be easy enough. Do it manually first then try to automate it with code
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?
Javascript, at least for web, is quite important.
Not sure if I'd recommend learning it fully rather than getting just the basics down, but it can't hurt
Any language will help get the basics down. The rest is mostly learning the syntax
python3 and javascript is good
It doesn't really matter which language you pick; my recommendation is to pick a language that has a common usage with the other goals you have.
Ok cool. Maybe I will learn Javascript too so I can also play screeps
Started off with python myself. Later went on to learn java, now doing quite a bit C++
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…. 🧐
If you are trying to simulate OOP encapsulation, that is not the way to go about it. C is as close to bare metal as most programmers get, it's not really about doing it "the hard way" it's about understanding the high level concepts associated with computer organization and architecture.
So In Learn Rust Room There's Question: What's the smallest sized signed integer in rust? Answer: i16, Wouldnt Smallest Be i8?
Are you working on any interesting projects? Would love to hear..
Despite the pain, I like the OOP simulation due to its organization. Being able to associate functions with structs and call them using dot or arrow syntax versus just having a naming convention for functions such as Class_method definitely appeals to me more. However if I was concerned about memory usage, I would probably use straight functions to reduce overhead.
A couple bytes overhead is a small price to pay for proper readability
tech interview tomorrow 😬
the only thing I know about the role is "Vue.js, SCSS"
lmao
Yeah I didn’t consider the actual usage. Even with embedded systems it’s probably not even a concern. I’m new to this space (systems programming) so I was speculative in my answer.
How precise
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)
Why do companies insist on bragging about having a terrible workplace? "High pressure" sounds awful!
It really does, it's like the 10x bs as well
Someone know how to use a ListView on visual C#?
I think its a warning rather than a brag. But Id like to know what kiwis think 'high pressure' is because things are generally pretty laid back here compared to other places. So maybe its just regular pressure, hehe
❤️
When a user press "Aggiungi", the price should be added to the ListBox
You posted that question 10 mins ago, no need to bump it bera
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
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
i want a base thing related to python can anyone help me!!
just ask the question, please
can you please dm
not really
i cant even put the file here
what's the question? you may add the relevent error messages and code snippets using the code blocks (```)
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
can you reword your question and example? What you're trying to do is not clear.
i want the python file to ask me what to put in number line or 11th line
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
we won't do your homework for you
hahah brw just fuck of
Hah, homie really got upset because you wouldn't do his homework
¯_(ツ)_/¯
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
let's not say anything we'll regret here
You sure about that?
knowing how to formulate a question clearly and concisely is an important skill to learn
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
I understand you are struggling, but the purpose of homework is so that you can understand the topic. If you cannot explain the purpose of the program, there is no point with showing us the code is because we are not going to do it for you.
If it is homework and you are struggling, please speak to your teacher.
guys plz its not campus homework and stuff
i trying to make a simple tool that will help me really good in future
Well, once again, there is no point in taking advantage of our knowledge. You need to learn Python and do it yourself
You will help yourself much more by learning what to do.
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
have you looked at the docs?
you just save your knowledge brw i dont want it i just asked a help
I think I'm starting to understand what you want, but I can't be sure
😪 finally someone
still can't help, because I've no idea what you're actually trying to achieve
recommend you read the docs
but aside from that your problem statement is really not clear
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
not sure how the AI will help with such a muddled question, but ok
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

This was our reaction too.
what a strange person
💀
not entirely sure, but above quote summarizes it nicely
Chatgpt be really cool, i would hate if Microsoft would charge 200 bucks for 100% functionality 💀
Is there a way to rename a Linux file without using the rename syscall ?
hmmm
isn’t the command mv
I don’t know what you mean by rename syscall
you can say
mv file.txt file1.txt
yes but the mv command uses the rename syscall under the hood
thanks. so basically a cp.
Gave +1 Rep to @true pumice
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)
Can you post the instructions?
@true pumice
Is this for schoolwork?
@paper timber C'mon dude
And you don't think their school could have asked them to complete xyz?
Also giving them the answer teaches them nothing.
Oh im sry 🙂
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 🤷🏿♂️
It doesn't say there was an error
gods damnit Quarkus really works a lot better with Java
one of the tests are failing
Yes but that’s not an error, the code isn’t erroring, the test is raising an exception, hence why you can’t open it in a normal interpreter and run the same code
May have misunderstood you are correct on that front, but I'd also argue a non-passing test is also an error 😉
Test is probably poorly coded though
These educational platforms aren't always the best
could it be it was expecting you to flip 24/6/3 to 24*3/6 ?
@final juniper the output checks out , i hate cengage its either their way or you will get an error
the output result is the same, but it says that you haven't used their intended operators, and i think that's the only one that can change
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
ok figured it out... its (3 * (9-2) + ((24 / (6 / 3)) * 3)) 
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.
That doesn't look like it'll match tbh
Hehe, might be. But at least i get all marked when i use: https://regexr.com/
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?
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
Yeah that's probably part of the regex
But [abc] will only match one character
Build up the expression step by step
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
[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
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
So i should use a "multiplier" like feks + or * ?
or as example say {0, } somehting
Throwing stuff at the wall will be way less effective and meaningful than understanding the definition of metachar, as the task suggests
* means match zero or more of the preceding. + means match one or more
The task also says to not use metachars
[a-c0-1] is somehting that comes to mind
Regexr should explain what the expression does though
but that is same pattern as before right
Thank you so far, need to do some thinking here. Gonna read all chapters one more time
Take notes
You’re right juun! I’ve been learning more and it’s seemingly impossible to develop a public API using opaque structs with function pointers. library_module_function naming for the win, lol.
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
you don't need to strictly specify how many times tho
How come, not even when you combine numbers and words?
I think they're referring to * and +
More efficient to specify counts though, as those can be unrolled
I understand, that makes sence. Was in the world when that was not allowed, hehe
yeah I was referring to +, it's my usual choice unless it can bring problems, like if you shouldn't select words with more than 3 letters
- and + are greedy operators, which can cause unexpected complications if you're too general with them
Yes I know there are non-greedy versions
The regex state machine is bonkers
look-back operators ought to be used way more often
those are....really finicky
im putting
#nameInput {
text-align: center;
}
and its not centering it
I made sure its the correct id
is it a block element?
what do you mean?
It's a crucial part of css
its in a form
I didn't ask what it's in
with the submit button right under it
I dont understand what you mean by block elemnt
element*
Normal Flow, or Flow Layout, is the way that Block and Inline elements are displayed on a page before any changes are made to their layout. The flow is essentially a set of things that are all working together and know about each other in your layout. Once something is taken out of flow it works independently.
It says <form> is a block level element
The only html that I have is
the form with the button and text input in it
nothing else
Send code.
ok
Why can't it go here?
It wont allowed me to put more characters
Jeez, send the files...
ok
In chat to clarify.
here
Problem 1
is it the <title></title>?
Ditch the commas.
No, it's the red squiggly line that always shows problems
It's centered.
Fixed all of that
but still same problem
What problem? It's centered.
Works in chrome
I want it to be centered on the page
Then you don't use text-align.
What should I use?
Sorry
Im not really good at html
I'd recommend putting some time into learning. I liked the SoloLearn CSS/HTML5 courses.
Personally I'd use css flex
I tried this
#nameInput {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
Doesn't seem to work
What did you do to center it?
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
No.
Then what is CSS Flex?
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
I have looked at a lot of things to see on how to fix it
but none worked for me
That's why I come here to ask for help
I can tell why from this
#nameInput {
text-align: center;
display: flex;
align-items: center;
}
I tried this too
Same problem
oh
You really need to learn how it works, otherwise it's going to cause you to run into the same problem over and over.
I know how it works
w3schools
is telling me that it aligns the flex item in the middle
but it doesnt
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.
You said it wasnt CSS Flexbox
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.
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.
Thank you, please refrain from asking in here^
Gave +1 Rep to @harsh crystal
Alright 😐
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
Didn't need fex
flex*
Already fixed it
Used margins
Yeah except the absolute inside a relative div wreaks havoc on modern browsers and is an accessibility nightmare
I am working on a input box
Margins are very, very unreliable
not a div
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
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
So many arrogant people in this channel 😂
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
Yeah but you belittle my experience
and call me in a way
trash at programming
Because your solution doesn't hold water
My solution worked for me
Flexbox didnt work form e
me*
You are right about flexbox working for divs
You want to centre an element, but did so in a way that'll break as soon as the window changes size
Just tested it
Nothing broke
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
I used your advice
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
Outer div as display:flex, inner element with flex: settings
but of course you all are to arrogant to tell me because I lack "experience"
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
Im confused with this
Do I make the form first a flex container?
Then make the name input for example a item?
flex iem
item?
Left side defines the container, right side the containee
That should work
Thing that goes inside the container, not really a real word I don't think
It's late here and I'm tired
Thank you
Gave +1 Rep to @brazen eagle
Your the only one that actually offers to help me
Sorry for calling you any bad words
It was not meant for you
Arrogant to be specific
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
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.
I'd just change 'container' to a class 'flex', as that indicates exactly what it does. 'container' doesn't really tell you anything
This is exactly the reason I don't engage with some people. Once they discount my advice twice, they don't get help any more.
I think I've been guilty of that, to you.
I seem to remember at one point I don't think I was very nice...
I tried to find it, but it was on my other account.
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.
sadly, we don't seem to have an osint channel on here
Doesn't sound like a programming question, try #infosec-general
<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?
Thats right
What would I call that?
is that because js has different elements dedicated to it?
kinda like how CSS uses onclick also?
ye, JS can be used outside of a <script> tag, like done in the code above where the JS is in the button element
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 😁
we may need help to know what it is you want help with... also, standard responses: have you done some preliminary research first?
is this for a class?
also that
yup
Someone understand me While / do while
🛑🛑
while Checks Condition First And Then Runs
do while Runs And Then Checks (||Tricky MF...||)
That's As Far As I Know, Anyway Forget do while D:
Use While when you want a loop to run conditionally, use do...while when you want it to run once unconditionally before starting to check
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
For python, there isn't one built in so you can do something like
while True:
print('xyz')
if condition:
break
Realistically do while is just syntactic sugar anyway iirc
or..
var = None
while var is None:
print('xyz')
var = something
you get the idea
That said, that's still an example of a While loop, not a do while
difference between do while and while is primarily an optimization thing - once the code is optimized there is no control over how it executtes
That was my memory of it
Yeah
I remember I had this argument with a couple of beginner programmers a year or so ago
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
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 (;;)
What does that get turned into again?
the reason for that is the check to exit is never evaluated, so it is technically 1 instruction faster than while (True)
Ooooh, interesting
I remember that as well and from a lurker’s perspective, it was very funny
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
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)
isn't a for loop at the base level a while loop?
If this is C, while is faster than for according to some of my sources that I dont trust completely
They're compiled to be basically the same thing 🤷♂️
It's plausible. But I would need to see some pretty rigid benchmarks to agree
Why on earth would you not just do:
for i in range(10)[::-1]:
# Do Stuff
There has gotta be an easier way to do that lmao
If you're iterating over a set list of values then a while loop doesn't really make sense 
Well, not at that level
Goddamnit, I knew there was an easier way to do that with range
for i in range(10, 0, -1):
# do stuff
range(10, 0, -1)
Aye
If it's python, the actual fastest way is to use a list comprehension
If it's python then why are we even talking about speed 
Not Really
kek
And yeah, assuming that # do stuff creates a new list
Yep
Speaking of for loops in python (that's the actual link)
Some People Want To Watch The World Burn
Did You Know You Could Do This In Java?
This is absolutely insane
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...
there's some sketchy methodology in that video.
the ending is the main point, the fastest way to loop is to not loop at all
yeah, i can totally agree with that. That's not really a python efficiency though
yes, but if you do that in production code I will hit you with nerf darts
I mean the C compiler will generally unroll loops to optimize
but manually unrolling is a bad idea for maintainability
Dont Dare Me
Also Lord Protect Me From Writing Java
@brazen eagle
Holy Shiz... I Want To Quit
And There's More Places Where o Is Used... Why Cant People Name Variables
it's one of the 2 hard problems in programming.
Naming Variables, Cache Eviction, and Off-by-one errors
clearly oo is an object object
Too vague smh
hi
Hi :)
Worst Part Is I Have To Make Docstrings For It D: Me, A Clueless Individual (About What Methods Do)
Jesus that's terrible!
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
oof
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
You mean like the Black Hat Python book?
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
Doesn't sound like something you can do.
Remembering, your sending mouse clicks - if you normally click it with the mouse it'll obviously focus it.
Why?
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
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"
}]
doesn't seem possible
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
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.
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
greatings
greetings
yes, and as I said before your sending mouse click events
oh shit yeah
which, of course, will focus the window
because thats how the OS deals with it
what language and data type is it being held as
python , i got it though thanks
Gave +1 Rep to @surreal bronze
ah okay
Anyone keen on Java and want to help a fella out?
yeah but free
Guys help me 🙏🙏🙏🙏
there is no way
Nothing? At all?
nill
nill?
what's that supposed to mean
i just downloaded x64dbg to try and RE the binary
nill = none = nothing
i see..
@surreal bronze difference between nill and null.... thank you in advance
Gave +1 Rep to @surreal bronze
Honestly not sure
Depends on what you want to do
https://paste.pythondiscord.com/wofoporaya.py just writing to/from a file trying to build an arraylist of strings
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
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
you know what I will see if there is a java discord somewhere out there in discordland
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
I think @true pumice that js is my next project
Holy shit that's insane
Is this so that you can get people to gift you games? If so, I think I can help
Like without them knowing I mean
No, it's for one of my clients
I have no idea what's his intention
It's a paid project
Oh I see
I'm doing it for the review (5 stars)
Your client seems really smart for trying to hire you
When you clearly don't know much
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 ""
:hammer: tzi02723#5689 has been banned.
Tried to be discreet with it 😅
expert in automatuin
how do I automate this
We have different definitions
shadow is an expert in stubbing their toes on small door frames
I don't know their intentions
I'm not a serious hacker
Seems like they need a lesson on ethics
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.
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
Thanks, then I have to figure out how much I care about speed versus coding easiness. I'll probably keep going with python so far as C++ is a lot of headache
Gave +1 Rep to @vapid cloak
Tbh, you won’t really notice a difference in speed unless you’re doing heavy computations. So, I wouldn’t worry about that too much 👍.
well, if I ever think of adding hashcracking, would that be considered "heavy computations" ?
depends on the hashing algo
the most famous ones, SHA, md5 , NTLM, that kinda stuff
hashing is always 'heavy computation'. Part of what measures how strong a hash is estimated time to forge an input for a pre-determined output
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
Is it possible to have the main program in python, but a separate module for hashcracking written in C++ ?
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
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
well so far it is basicly only jumbo john and hashcat for offline password cracking
Now I am gonna need to figure out the drawbacks and if this is a best practice
It's almost always a "use your best judgement" call. If you do it, it should be explainable and understandable for the decision you made. "Because it's cool" isn't sufficient, "a personal learning project" is.
yeah that's something pushing me off of adding that feature currently
fair enough
And the sooner you figure out TDD And BDD if you don't know them, is to your benefit.
heard of TDD did not recognise BDD in an instant but figured it out inside of 5-10 sec
I'll google them
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
can't help with homework I'm afraid. Good luck
and is not easily applicable to some types of code bases like games
it's always applicable
if you think it isn't, then you have a design issue
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
Thx hydra
Gave +1 Rep to @brazen eagle
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)
Not even in theory, there are mock libs to do exactly that on practically every language
depends on the techno and the language, but yeah
though I'd expect Unity and Unreal to have something
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
can probably use NUnit or something for C#
at least I think it's N, haven't used C# in forever
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
ye
yeah that's what I'm wondering
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()
maybe I'm missing something, but I'm not seeing how game() is called
game is a second display
can you elaborate what you mean by clamped?
that doesn't tell me how it's called, right now it looks like a generic function
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.
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 🤔
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
yeah it's a volume, so managed by docker itself
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.
Find the code that validates what arguments there are and check to see what errors it throws?
I personally would advise against this as it's a bit messy and just throw out the --help menu, but if you want to do it I'd suggest reading the argparse source 😄
If I do this would it wipe out my redis data 🤔
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
It wouldn't wipe it (the volume would still exist), but it also wouldn't be accessible to the container until changed back
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?)
something like that
Either way you ain't going to be grabbing the data that way 
docker-managed volumes are pretty opaque
Out of curiousity, what's your go-to for data volumes? I've been kinda dithering between docker volumes and hidden ./.data directories in different projects for a while now
Obviously local docker, swarm would be rather different
generally use docker volumes
How are you handling redundancy and backups?
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
Interesting 
I really need to go do some Kubernetes
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
Yeah, that's the conundrum
I use RO mounts for config files that need to be version controlled
think you can import/export volumes though
at least podman does
PVC is specific to k8s, there's an equivalent in docker but i don't remember what it is
docker has volumes, dunno what swarm uses
but a regular docker volume mount is ephemeral
Also volumes iirc
that's why I'm saying it's mostly disposable
@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
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
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
Hello. Please does any one spam here. I need to grow my company. Thanks
@true pumice
Elaborate?
yeah i need a good spammer who spam for office 365 and personal domain . do you do that please advise ?
do you do that ?
Like email spammer?
yes
:hammer: williams50#5246 has been banned.
This was very satisfying to read and I love the ending. 10/10.
Eh, predictable, 6.5/10
boooo...the crypto library I'm using fixed the JVM bug I wanted to exploit 😦
how could they
Use the older versions 😎
~~#1 rule - never update libraries ~~
yeah they did something weird and I can't seem to find the value I need to bypass the signature
the standard DER ASN.1 encoding returns as invalid
ugh probably because it wants a raw string
as in a non-encapsulated literal?
or a reference to the actual canonical String object?
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
isn't that vuln one of the reasons ECC is discouraged?
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
Huh weird
Do you not have older copies or does it auto update?
I set an older version of the dependency, and am normally on a vulnerable JVM
the POC'd value seems to not work
interesting article I found on this problem
that's the one
I should in theory be able to throw a bunch of A's at it but that appears to crash the lib, so now I get to break out the debugger
Interesting. Maybe you aren't using the right version of the bad lib?
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
ok that required some arm-twisting....
so umm, hacky code is hacky
Gods why is intentionally breaking something so difficult?
Shift left works?
Yeah but also frameworks are including better defaults
Also I think the library had an inadvertent bug that improved security
It was converting my A's to 0x300402000200 instead of 0x3006020100020100
Can any body tell me resources to learn bash for free
@lilac holly Here please 🙂
https://gist.github.com/66672136ca90731dc841d811aa7bd075
This is my code its kinda noob , bc i started python yestesday
I get a problem that is
else :
new_number2 = "not defined"
This line in the code is not working
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?
That's such a big OR chain aa
Its not error
Everything is working
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
I'm pretty sure there's a library function to tell you if something is numeric or not
There is
int() will raise an error
There are multiple libs that have that check, for different purposes
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
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
Yeah ok that makes sense
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
Yeah but that'll convert to the ASCII range for the character, yes? Well, UTF-8 more likely
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
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'
Well or 'b' resolves to true
Ok
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.
Is there a easy way to do it
I had to write all the alphabet
Any easy way
I still have to write the alphabets
Mhm, but, unless you want to import an outside module, you will have to write in manually
Like
Google "import alphabet Python"
Oh and the functions name.
Not even the syntax that python expects. It's basic programming truth condition evaluations.
n.__index__

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
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
True 🤷♂️
I need some ideas for pentesting features or tasks I will implement in my mutlipurpose cybersecrurity tool (python)
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.
you have a lot of repeated blocks of code, consider refactoring those
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?
If you have system admin background, start scripting with bash or powershell. Learn to automate tasks with python, and eventually the things you want to do will require more knowledge and effort; programming is an application of problem solving. If you can write an intelligible flowchart, you are halfway there.
ok, Thank you!!!
Gave +1 Rep to @magic falcon
Please re-read the rules of the server 🙂 #rules
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?
oh boy is that a rabbit hole
I want it to be fully integrated with the linux system, like when I type in the terminal:
myToolName
it should turn blue and be accessible from anywhere in the system
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
You'd still need to add the symlink to a directory in PATH
Alias sure that works too
I finally published the first release
what do you think?
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
it's straightforward but yeah why not
I figured it would be easy to implement it that way
a menu looks cooler
and I'll fix that bruteforce issue ig
thanks
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
Python dependency management and packaging made easy
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
poetry init
poetry build
poetry publish
Also checkout https://pypi.org/project/black/ and https://flake8.pycqa.org/en/latest/
For cleaning up your code
I can see a lot of code that's been repeated (functions too) , flake8 should deal with thoes
flake8 is a style and linter, it may not pick up on copy paste code as well as you think
flake also won't remediate those problems, just make you aware of them
Ah, maybe I'm getting mixed up with another tool
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
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
Huh interesting, haven't had this problem but ty for the insight - will lookout for this when I use it next
Gave +1 Rep to @magic falcon
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
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
Some lessons have to be learned through experience
This is true ask me how I know
kek
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.
Gave +1 Rep to @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?
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.
and what can give a plus to this way is the tab complete feature, I should really think about this
ktool --help for a help menu
Yup, if you look at popular open source tools you'll see that they mostly all follow this format
Hydra, fexobuster, gobuster, ciphey, ffuf, nmap, you name it
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.
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 
Strike the -- on the tool to use
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
gets out the garden hose time to make this the wettest code ever
Dry meaning "Don't Repeat Yourself", within reason of course
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)
and I hope to never have to do this
it was part of my undergrad research. I built a control plane for a UGV, it was for an engineer so there was approximately 100 buttons and output displays on the UI
that sounds about right for uni work
I think this is very similar to how I thought
all in one thing vs does one thing
and does that well
Last part is key
Again, go read the Unix Developer Guide.
I'll check it out
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.
ok
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.
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()
didn't see this woops
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
What's the global mood?
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
Oh okay, so it makes it available for changes?
yee
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"?
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?
I meant the mood
Nope, Im gonna read up on it tho. First time hearing about it actually
Im really, really new to coding
and nah it would just repeat
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?
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()
And it only works on happy because its at the end of the list?
Thank you!
Gave +1 Rep to @tender pewter
<3
with this code it doesnt work on happy for me
but if you get rid of a tab so that it's outside of that if mood = list then yea it'd work