#programming
1 messages Β· Page 31 of 1
Does it work?
nope the data is not coming
do i send the code
try {
Class.forName("java.sql.DriverManager");
con = DriverManager.getConnection("jdbc:mysql://"+ip+":"+port+"/"+db+","+un+","+pass+"");
}
plz check does url is correct
in net beans java its all good "jdbc:mysql://ip:3306/db", "un", "pass"
Guy s I have a question
I have no idea why the outputs are different
I thought they are the same thing?
List comprehensions build a list.
I see
Using a list comprehension in the second example, builds the list, then prints the list. In the first example, the list is prebuilt and you are iterating over the list, printing each item.
Are you providing a port number for the service? (Just guessing based on the error message showing the String Port)
missing some slashes, no?
the slash after localhost normal?
probably Discord formatting - it's weird like that
would explain the error though
unless the GeckoDriver isn't the right one to use anymore
should be using Marionette in any case
though GeckoDriver stopped working after Firefox 45
seems to just need the binary
Thanks
Gave +1 Rep to @heavy rampart
I don't know if this belongs here but I'm having a rough time trying to do something that I think should be basic lol.
I'm using Python and I want to find the path of a favicon. I tried using the beautiful soup module but I wasn't able to do much and now I'm trying with regexes but the same thing.
Does anyone have any suggestions?
Here's my mess of a code, sorry:
from bs4 import BeautifulSoup # To parse HTML
import requests # Use to get HTML of website to put into bs4
import re # To match hash with defualt favicon database
def defaultFaviconScript(userTarget):
sourceCode = requests.get(userTarget)
if sourceCode.status_code == requests.codes.ok:
sourceCodeString = sourceCode.text
faviconPathRegex = re.compile(r''")
print("Paste a website link.\n")
target = input() # Target website
defaultFaviconScript(target)
Is it not just /favicon.ico?
that's the name of the file but I need the full path
This one is in an an "img" folder. I want to be able to find it regardless of what the file path is.
Do NOT parse HTML with regex.
Yeah I've gone back to beautiful soup and I'm going to try and get that to work
can anyone help me how to improve problem solving in programming
Check out Project Euler and make sure you understand problem decomposition
thanks a lot bro i will try that have a nice day
Gave +1 Rep to @onyx merlin
Please don't call me bro
oh sorry
sorry I forgot to mention (I keep on going back and forth to them), but I checked out all of your resources for learning C. Thanks a huge bunch @hollow tangle and @stone kayak @magic falcon @tulip ibex @fickle siren exercism is actually really cool but a bit of a brickwall at times! π ty so much
Gave +1 Rep to @hollow tangle
the favicon path should be in the metadata under the head tag IIRC
I'll have to check it out some other time. I spent almost the whole day trying to figure it out and I just gave up for the day. The problem I was having was that I was struggling to scrape the path to the favicon so the href attribute value.
for example:
Awesome! Check out runcode ninja too in a few months when they're done renovating. They host challenges geared towards infosec so automating nmap scripts, reverse engineering etc
you are a star!
ok so I am just curious? with literally not more than 500ms of diff in my reflex why is there a difference in my pids.
sorry, if this was too noob
Most likely the parent process id code in your shell script is incorrect. Are you using $PPID or $PID (aka $$)?
Seems to be incrementing by 4 each time, could be 3 other processes involved in launching your script?
i was using $$
ahhh, right, any ideas of what they could be?? Just wanna knw π
I was just playing around tho
I tried removing all the other echo commands (thought they might be taking some pids but no effect it was same difference of 4/3 processes)
Ok
Could it be the os attempting to fortify against guessing the next pid? Otherwise I'd probably ask google :)
also, what is the difference between $* and $@ (stackoverflow showed something first character of IFS is what $* shows and stuff... I got lost and went seeking help π (yes I need to google properly; sorry)
yeaa, not proper answers for the PID one... that's why I asked it first
One probably shows the array, and the other a string representation?
ohhhh wait a sec... i think i got it
umm just a sec, ill try it out practically
PARRRFFAACCTTT
Cool
sadly IFS is limited to 1 char only... (so no escape characters can be used \n \t)
this was nice β€οΈ thx @brazen eagle
Gave +1 Rep to @brazen eagle
Is \n not considered a single character?
it is... but like, if u have to specify \n it's 2 characters as a string
Pretty sure env vars escape, or what about wrapping it in quotes?
Single quotes don't eacape
nooo this was the script
yeaa, i just saw the -x (debug switch) encloses the output in single quotes
Well darn
Apparently it's IFS=$'\n'
in the second one, I tried with the $ sign in front of it, it didn't show any change
For the record
π± hah, guess i would never knew if it wasn't for u
thx tho β€οΈ
it cleared my confusion of $* vs $@
and as for my knowledge it works with single quotes (literal string) rather than double quotes (a dynamic string, can i call it?) where as may be it tells IFS to take the $ (value of) single quote enclosed \n
If you write shell script, definitely read the wooledge wiki.
https://mywiki.wooledge.org/DontReadLinesWithFor
thx β€οΈ will surely check out
Can someone help me figure out why I am getting this error?
The error explains exactly what's wrong
Is this your own python script?
If you are importing a Queue class, check whether or not you're doing this:
# Example 1
import Queue
# Example 2
from Queue import Queue
There's a difference between these two statements.
One that I'm studying
Check that your .py file is trying to execute as py2 and not py3. This looks like a library location problem.
Good shout
yeah didn't think about that one
That is what I was thinking, but I'm not sure how to confirm that. Should I specify at the top python2.7 rather than python?
why dont you run
Check that your .py file starts with #!/bin/python2 or something equivalent
python3 {PYTHON_SCRIPT} {TARGET_IP}
Same error. Tried running python <script> <ip> as well
im so confused
Ok, so in your .py file there should be a line that tells your file what python environment to use.
Check that the .py file also uses the Queue module exactly the same what you ran in your interpreter.
Still confused, but finally got it to work. I'm hoping you may be able to explain it if you have the time.
Instead of:
queue = Queue.Queue
I changed it to:
queue = Queue
I had to make these changes throughout the program. Now I don't know why I don't need to call the Module to call the classes. This is where I am confused. I thought if I do this:
import Queue
It imports the module, so I have to call the module to use any classes or functions. From my understanding my program is actually responding to the Queue module as if I imported it like this:
from queue import *
imports also work slightly differently in py2 vs py3. IIRC, and this may not be accurate, py2 does NOT import the top level module namespace, but py3 does. Which could be why you need Queue and not Queue.Queue. The from <module> import <thing> syntax is the preferred import in Py3, due to the potential reduction in naming collisions.
Thank you! I appreciate the response
Gave +1 Rep to @magic falcon
anyone good in java can dm me rq plzz?
Huh?
ayee, is this ur site? That's creative π β€οΈ
@polar rock Nah, it's just something we link people to when they ask questions like that.
Yeah @polar rock
Itβs an awesome site haha
ohh, so one of u guys own it? (tryhackme people)
Nah, it's a site operated by someone else who has nothing to do with hacking
In fact, I do believe that their most likely a dev?
no coz I read this... whitetiger asked the question about java... and the site's also taking an example of java...
Any coincidence? Or can u make it custom? π€
yea, seems like it
just good luck, that's why I thought of it haha
so is this better?
i have a code im doing for a project a otp and qr login thing and ive done it correctly and i dont know why its not running
like it goes to the page and stuff i can register and it shows i registered in the database and stuff but when i try to login its an error and it doesnt send to my email i even turn on less secure apps setting and it still wont im just confused
I am not a pro in java so I can't help u there... Tho if u have a problem with ur code, u can put it here or on GitHub and share the link, anyone with sufficient java exp may be able to help u outπ it's actually hard to say what u could be doing wrong without looking at the code u wrote
is this project one you are being paid for, or for a course?
No it's for a course
Actually don't have git
But what's the best way to send it here without having to send piece piece
If I call a class is the automatic behavior to run all the functions defined within that class? If I want to call a specific function within the class it would be <class>.<fucntion>
Is this correct or incorrect?
You don't 'call a class'. @neat ocean What language are you working in, and what are you trying to do?
I'm trying to understand how classes operate. For example whenever I "call" (whatever you call it) it runs init , but wont run "run"
Python is a really bad example to use for OOP.
Right, because you don't 'run' a class. You instantiate it.
init is a special function that contructs an object from the class.
Wouldn't that mean that all defind functions should run?
The class is a blueprint, the object is the thing in memory.
No.
How deep down the rabbithole do you want to go with this?
self being the object correct?
I can give you explanations at a few different levels
Yes
self is the pythonic equivalent to this that you will see in a lot of languages that have OOP fully baked, as opposed to the python way of doing it, which is 1/4 baked at best
I would like the more involved explanation if possible. My current project is to create a basic multi threaded ip scanner, but I'm just trying to get the basic concept down before I dive into the threading, queue, and time modules.
This is really the only thing left that I don't have a great understanding of
The short answer: A Class is a blueprint that has variable and functions attached to it. Those variables and functions can't be touched, under most conditions.
the reason for that is that the an object has to be instantiated from the class
you can think of it like a 3D printer.
You have a model of, say, a dog. You don't have the dog yet, you just have a model.
But you can print the dog by instantiating it from the model using your printer
does that makes sense?
Okay I think i understand why your saying instantiated because the class and the functions defined within are the model you speak of. Whenever the class is created it is only "alive" until the class is completed and then all "data" is essentially erased.
To give another example - Lets say you have a 'car' class.
You can describe the things a car ought to have, but those things don't exist until the car is built
Lets define a function openDoor - it should perform the action of opening a door
But you can't open the door until the car is made; it doesn't matter if the car is a Honda, Ford, Toyota, or Fiat. The car has to exist before any of the things that a car does, can be done
The abstract blueprint is exactly what a Class defines. You would need to instantiate the car, with some code that would look like accord = Car().
from there, accord.openDoor() calls the instance method to affect the state of the object
oh okay that makes sense.
So why in my code would init run automatically if the instance wasn't called?
No
It gets parsed, the init code doesn't actually run until the constructor is called
now, if you have print statements in places that they shouldn't be (which can be useful for debugging) you WILL see those outputs. Because python is great in a lot of ways, but python interpreters are pretty dumb
there is also a difference the abstract purity of what i'm talking about and how python interpreters take your module and use it.
The constructor is init correct?
The constructor is the special method that gets invoked to 'build' the object from the class
In python, that's the special __init__ function
So the constructor gets called immediately once the class is created?
example = workerExample() <--- This is what you mean by that correct?
or do you mean at this point example.run()
By the way, thank you for the help. I'll see if I can take it away from here.
Gave +1 Rep to @magic falcon
This is call to the constructor
This is the call to the instance method
This is also what you mean when you are instantiating an object from the workerExample() class.
Hello I'm brand new to python and I had a question if anyone would be willing to answer it.
Why is the answer not 4? why doesn't the elif 3<5 turns a = 3?
It was my understanding that the elif would overwrite the original 'if' if it were true (3 is less than 5), and the else would only overwrite the elif if the elif were also false.
Elif only executes if "if" returns false
thank you
Well GitHub it is... It's easy to sign and drag drop ur project folder in a public tepo and share the link here
Could someone explain how this works?
I answered 9 on the top one because I thought it was a* b+1 (4* 2+1)
Oh I guess it would be hi(4 * 2 + 1)
It would be 4 * (2+1)
At func hi:
a = a(from hello) = 4
b = b+1 (from hello) = 2+1 = 3
Then, a*b= 12
Similarly, for 2nd one
I'm kinda lost now, I don't know what to do next to proceed
I learned python on sololearn and can understand the code in some small programs
People told me to build a small project but I don't know what to, every idea I came up with, I can't do it, just stare at the screen blankly
I think I need a hand, if possible can you tell me what should I do ?
So you have a project you have an idea for, but you are having problems implementing it?
Yeah
It went like this
I have an idea for a project that would get audio from an app (in this case zoom or google meet), transcript it and play an alert sound to me whenever it detects my name is called
Then I searched for voice recognition for my language, then stumbled upon a perfect one but it uses machine learning to transcript, I went to the github pages but it is implemented in flask, then I had no idea what to do next
And I'm stuck
I never got any projects in hand
So you are making it too complex to start with
You are trying to rip audio from a stream that I don't think you know the API for, and perform a task you have no real idea how to do
If you really want this, simplify it into bite size chunks you can get done and then move to the next part
Then you are only solving 1 problem at a time, instead of solving the API problem, the audio format problem, and the transcription problem
Break it down
Can you diagram the different steps with UML, and figure out where the dependencies are?
No...
And, once you have identified the dependencies, can you re-frame the context of that problem to remove the dependency?
Do you know what UML diagrams are?
Reading Time: 9 min The Unified Modeling Language (UML) is a diagramming notation (language) that lets you visualize systems and software. Here is how to use the 14 different types of diagram and create them in draw.io.
At first glance, looks like its OOP am I wrong?
You are wrong
Thanks
UML is a way to visualize your problem space, OOP can be represented in UML, but UML is much more than that.
I see
You can use it to visualize sequencing, timing, state transitions, complex interactions, control flow, data flow, and overall system architecture
ohh
Use case diagrams, for example, are great at demonstrating what the program should do, from the user perspective. It helps answer the question of 'How do I interact with the system'
Anything you can do to break a problem down to a simpler problem or set of problems will give you a much better idea of how to approach and implement a solution
Thank you, I think imma read it and see if I can break down the problem into small parts then solve it
That drawly link is a very basic introduction to UML - there are more technical resources you should look for, but that should be enough to get you started
i have a code im doing for a project a otp and qr login thing and ive done it correctly and i dont know why its not running
like it goes to the page and stuff i can register and it shows i registered in the database and stuff but when i try to login its an error and it doesnt send to my email i even turn on less secure apps setting and it still wont im just confused
What tags do I need to use to post a small section of code?
enclose the code in 3 backticks with an optional language after the starting backticks:
```py
print(1)
```
is
print(1)
Thank you!
This is the code I'm working on
print("What movie do you want to watch?")
answer = input()
while answer != "WALL-E":
if answer == "Transformers":
print("No, that movie is too scary! Let's watch a different one.")
answer = input()
print("That was fun.\nLet's watch another one. What movie do you want to watch?")
answer = input()
print("That was my favorite movie of all time.\nI think I'll power down now.")
So this is supposed to return a few different prints based on the answers. but it's really..funky. After answering "Transformers" and then "WALL-E" it will return "That was fun..." and if you enter "WALL-E" again it will THEN return "That was my favorite movie..."
It should return "that was my favorite movie" regardless of when you input "WALL-E"
From the snippet you ahve posted, nothing is returned. The from the behavior you are describing, that matches the code as it is.
The problem is that you're checking for input at two separate points. Suppose you put in Transformers, then Wall-E. You're then prompted for another answer that's not at the end of the loop
juun is right that it's not supposed to "return" anything, but I think you just want to say it didn't "print" the way you wanted it to
Return is a specific thing that is not what you're doing
I see.
yes it is not printing the way I want it to.
or the way it should, i should say.
print("What movie do you want to watch?")
answer = input()
while answer != "WALL-E":
if answer == "Transformers":
print("No, that movie is too scary! Let's watch a different one.")
answer = input()
else:
print("That was fun.\nLet's watch another one. What movie do you want to watch?")
answer = input()
print("That was my favorite movie of all time.\nI think I'll power down now.")
It's really hard to explain this in text for me, but I encourage you to look at your code with the same process that a computer would, as opposed to what you 'think' it should do
Hmm yeah that makes a lot more sense. And I'm just now realizing I should have been using an else condition. I thought the assignment wanted me to do this with only while and if.
Jeez π€£ Thank you
np
you could kinda remove the answer=input()
inside the loop
and replace it with a break
print("What movie do you want to watch?")
answer = input()
while answer != "WALL-E":
if answer == "Transformers":
print("No, that movie is too scary! Let's watch a different one.")
#answer = input()
break
else:
print("That was fun.\nLet's watch another one. What movie do you want to watch?")
#answer = input()
break
print("That was my favorite movie of all time.\nI think I'll power down now.")
While using break does work, it's usually not recommended for projects of any non-trivial complexity. The reason for that is the code starts to look less like structured code and more like the bad old days of spaghetti code.
ah would take dat suggestion and keep in mind thanks
No, you couldn't. The code would get stuck inside the loop, because the input wouldn't change anymore.
oh freak my bad thanks for corrrecting it
# walrus operator, is it good or meh?
while (answer := input()) != "WALL-E":
.
.
.
anyone here good with sdl in c++?
Last time I touched SDL was ~6 years ago. Please just ask your question, and don't ask to ask.
anyone no how to get the value from column in mysql sum(total_amount)-sum(paid_amount) into netbeans java
select sum(total_amount)-sum(paid_amount) from wheat_entry where partyname='Pramod';
this is query
in netbeans java i m getting this error column sum(total_amount)-sum(paid_amount) not found.
Don't think you can do math like that in a query
Ofcourse you can, you can do alot of crazy stuff in SQL π
But the example itself has errors
SELECT SUM(total_amount - paid_amount) as left_to_pay
FROM wheat_entry
WHERE partyname='pramod';
Can someone suggest a good resource for advanced coding/competetive coding?
There are also plenty in the pins
Dude that url is just so close to being something elseπ
Exercise -> Exercism. It's not related to exorcism
Ik, but it's just soo closeπ sorry
Do you think it's not intentional?
But thats creativeπ
>>> test = subprocess.Popen((["ifconfig", " |", " grep", " eth0"]), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>>> out, err = test.communicate()
>>> print(err)
b" grep: Host name lookup failure\nifconfig: `--help' gives usage information.\n"
>>>
why isnt't this working ?
try print(out)
You are trying to run ifconfig \| grep ' eth0'
This won't use the PIPES like you wanted to use
There can be multiple ways to perform what you want
Just a few
- use `re` module to grep yourself
- run `sh -c 'ifconfig | grep eth0'`
- manually `PIPE` the output into another process instance
import re
from subprocess import Popen, PIPE, STDOUT
process = Popen((["ifconfig"], ), stderr=PIPE, stdout=PIPE)
result, _ = process.communicate()
# I haven't used `re` because there isn't much to make use of it
for line in result.split(b"\n"):
if b"eth0" in line:
print(line)
I hope this code works, me being sleepy at the time of writing itπ
There is shell=True as well, but I won't use itπ
Why is if triggering? 0 should return it false right? but still if is executing
This is the debugged output... I never used the -n switch
sc
is there anyone to help me about uml diagrams
Just ask the question
I don't have only one question
I need a big help
I'm trying to crate a class diagram about mobile health management system
you know what a class diagram is supposed to show, yes?
Can someone recommend a challenge that'll include quite some code review needed in languages such as javascript or php?
I have two Functional Components, A1.js and A2.js . In A1.js I defined 2 state variables using useState(), how can I access those State Variables in A2.js?
Ah, you're already here.
This looks more like what you're looking for. https://www.pragimtech.com/blog/reactjs/usestate-component-communication-in-react/
Mind you it's been a while since I built react apps, so things may have changed since.
how to pass data between functional components from parent to child, how to use callback functions to update state in functional components, how to use useState to pass state data between components in React
Make sure to look at the useContext hook as well. I think it's used more for 'global' state, but I might be wrong.
Ok bro, thanks for the references
Np
If A2.js is a direct child of A1.js then you can just pass props if not then redux or context
I found this in a source code of a upload filter
is 60000 (file size) denominated in bits
in php
so 60000 bits = 7.5 kB
or depends on the function being used
could make sense, I've seen restrictions that small for avatars a while back
also bits seems an odd unit for file size
considering you always end at a byte barrier
hey anyone of you have experience interviewing with amazon for SDE profile?
I have my interview sheduled next week.
What is SDE profile? Never heard of a position called profile.
SDE is software development engineer right?
exactly
Software development engineer
What division of amazon? Before applying you should do some research on how devs are treated - I have contacts who were hired at associate and mid-level developer levels, the things they say aren't super complimentary.
In general, what I know of Amazon interviews is that they're super demanding - schedule wise.
No idea if that's any different to other major tech corporations, but having a day of interviews after another isn't easy.
I know people who worked at Amazon and weren't complimentary either.
For passwordless authentication we use Define Auth, Create Auth and Verify auth challenges. For those lambda functions do we need to create API or sendCustomChallengeAnswer() is enough?
Are those from webauthn?
yup
Api should already be implemented in the browser
You may need to do some work server-side
For this do we need to create API for those 3?
With increased use of different applications, social networks, financial platforms, emails and cloud storage solutions, managing different passwords and credentials can become a burden. In many cases, sharing one password across all these applications and platforms is just not possible. Different security standards may be required, such as passw...
I'd assume aws has an implementation
Hey, what's the easiest way of monitoring web requests on my local network? Can't use fiddler/charles etc on the victim, can't use proxy but can use VPN. Was thinking of making a local VPN server but not sure how you would access https queries then. Thought maybe there's an easier way.
tbh only thing I need is to monitor outgoing URL's with their data, content-type, body etc
plz check what i m doing wrong in this code SELECT sum(e.total_amount) - sum(p.amount_paid) FROM wheat_entry e full outer join wheat_payment p on e.sno=p.s_no; i m getting error as full is not valid at this position.
Remove the full keyword
Then you'd need to MITM unless it's plaintext
Yeah, I assumed so. Do I also need to have to decrypt/encrypt using own cert etc?
You can set a proxy for the whole network and tunnel everything through it. That's what schools do for MITM and monitoring.
But that has to be done on the machine right? Thatβs the one thing I canβt do.
You have to install a cert on the end device
VPN is fine but specifically the proxy is a no go
If you can't do that, then you don't own the device
And if you don't own the device, you should not be attacking it.
Basically im pentesting a friends software and the way he blocked my last attack was by detecting if I had the systems proxy enabled and now Iβm trying to see how to circumvent that π
He fully consents to it, i can prove that if needed π
You got a full legal contract?
what?
You'd be surprised how much trouble people can kick up
well itβs a very small company and he has rewarded me in the past so iβm not worried. also, isnβt that how some people make a living? just finding vulnerabilities then getting rewarded?
so is that a nogo? @onyx merlin
The company is likely to sue you to oblivion if you break anything
Bug bounty is different because you have a contract through that
It's certainly not a living in most countries
damn, okay well im very very sure that iβm not getting sued π
so letβs say i have a legal document explaining them permitting me. whats the easiest way of sniffing their requests? π
We don't work like that here.
:( having so much fun testing their security
!rank
try that in #bot-commands π
song_id INT,
title VARCHAR(60),
artist VARCHAR(60),
release_year INT,
genre VARCHAR(20),
PRIMARY KEY (song_id )
);
INSERT INTO song VALUES
(100, 'Hey Jude', 'Beatles', 1968, 'pop rock'),
(200, 'You Belong With Me', 'Taylor Swift', 2008, 'country pop'),
(300, 'You\'re Still the One', 'Shania Twain', 1998, 'country pop'),
(400, 'Need You Now', 'Lady Antebellum', 2011, 'country pop'),
(500, 'You\'ve Lost That Lovin\' Feeling', 'The Righteous Brothers', 1964, 'R&B'),
(600, 'That\'s The Way Love Goes', 'Janet Jackson', 1993, 'R&B'),
(700, 'Smells Like Teen Spirit', 'Nirvana', 1991, 'grunge'),
(800, 'Even Flow', 'Pearl Jam', 1992, 'grunge'),
(900, 'Black Hole Sun', 'Soundgarden', 1994, 'grunge');
-- Modify the SELECT statement
SELECT genre, COUNT(*), MAX(release_year)
FROM song
GROUP BY genre
HAVING release_year >= 1970;```
Could anyone tell me what's wrong with this SQL?
I keep getting this error
ERROR 1054 (42S22) at line 22: Unknown column 'release_year' in 'having clause'
I figured it out. The last line needed to be
HAVING MAX(release_year) >= 1970
Hello. Any python students or professionals here?
I totally understand the notion here, but I wasn't going to ask for help on a coding problem. However, I should have been more direct
It has less to do with that and more to do with the fact that you should just throw your actual question out there in the first place so someone can come by and respond π
Unless you just wanted to know if people know Python here, in which case, yes
Would anyone mind troubleshooting a bit of Java for me? I'm getting an String Index out of bound exception when I input a string int charRemovedCount = 0; Alg1 = Alg1.substring(0, 1) + Alg1.substring(1).replaceAll("[aeiou]", ""); int vowelsRemoved = len - Alg1.length(); for (int i = 0; i < len - 1; i++) { String a = Alg1.substring(i, i+1); if (a.equals(Alg1.substring(i+1,i+2))) { for (int j = i + 1; j < len; j++) { Alg1 = Alg1.replace(a, ""); charRemovedCount++; } } } All variables are defined outside of this snippet, Alg1 is for Algorithm 1 as I have to run a few different changes on the same inputted string.
Sorry the formatting got messed up
is this for a CTF?
No, just a HW assignment
hmmm
you might want to check where the exception's occurring first
i see 2 very likely spots where it could come from
It was occuring in two spots seemingly randomly
Depending on the inputted string
I couldn't figure out a pattern at the time
if it helps, maybe try stepping the code through a debugger to see what's going on?
i think i know what the issue is, but as it's a homework assignment, i don't want to give the answer away
set breakpoints at where you think the exceptions would happen
check your variables to see how they're being affected
I only have access to a Chromebook for this kind of work unfortunately
So I'll just add the manual breakpoints as you suggested
This is why I prefer Python, easier to debug imo
But that might just be my bias in having learned it first
you could also try rewriting this code in Python line-by-line
the issue might be more easily discovered that way
HolySloth, usually we don't help with homework. Your instructor and lab assistants should be the first point of contact for help with assignments.
That said, fsharp's advice is what I'm seeing in your code as well. And java really isn't any more difficult (nor easier!) to debug than python, it's just a matter of knowing how to use your tools appropriately.
I can also see two possible spots, and a couple additional issues. You should be clearer with your naming though, it will help with understanding what the code does. Maybe split out some of the inner loops as separate private methods as well, properly named, which can help with the cognitive load
Hey All,
trying to make a "Notes Generator" for doing my THM & HTB rooms
#!/bin/bash
ROOM="$(echo $1 | tr -d ' ' | tr '[:upper:]' '[:lower:]')"
URL='https://tryhackme.com/room/'"$ROOM"
echo "${URL,,}"
mkdir $ROOM
cp ~/PenTesting/Templates/Notes_Template.md ./"$ROOM"/"$ROOM"_notes.md
cd "$ROOM"
sed "s/\[#MachineName]/'$1'/" "$ROOM"_notes.md -i
sed "s/\[#BoxLink]/'$URL'/" "$ROOM"_notes.md -i
template
# Notes For [#MachineName]
[#BoxLink]
[#BoxLogo]
## Info about [#MachineName]
the second sed "s/\[#BoxLink]/'$URL'/" "$ROOM"_notes.md -i fails with error ```sed: -e expression #1, char 23: unknown option to `s'
The problem is with slashes: your variable contains them and the final command will be something like sed "s/string/path/to/something/g", containing way too many slashes.
Since sed can take any char as delimiter (without having to declare the new delimiter), you can try using another one that doesn't appear in your replacement string:
replacement="/my/path"
sed --expression "s@pattern@$replacement@"
Note that this is not bullet proof: if the replacement string later contains @ it will break for the same reason, and any backslash sequences like \1 will still be interpreted according to sed rules. Using | as a delimiter is also a nice option as it is similar in readability to /.
@true pumice thanks
Gave +1 Rep to @true pumice
I would suggest copying and pasting your errors into google in future.
If youβre having a problem thereβs a chance someone has already had the same problem as you out there.
I typed βsed unknβ and instantly got the error that you received and the first google search result was the stack overflow result π
Yes I was just referring to personal opinion, Java is harder imo due to my unfamiliarity. Obviously the language itself isn't more inherently difficult
If you want to get good at a language, use the language. Don't fall back on Python because you're having a hard time with Java, that's just going to make a bad habit later π
hey guys
Yes I just currently, suck.
if you're able to run IntelliJ Community on your rig, I'd recommend it for Java dev
btw pro tip for debugging with Python, if you're working with newlines but are struggling with them, put the string inside a list so that it doesn't parse the newlines and so you can see which special chars it puts where
can be handy af when working with a lot of r&w files
hey, I have problem, I don't know how add text on the picture and add link to website on this photo
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta http-equiv="Refresh" content="x">
<title>Ε»yczenia ΕwiΔ
teczne</title>
</head>
<body>
<img src="zdj.jpg" width="100%" height="100%">
</body>
</html>
Links are done with the anchor tag (<a>)
I think there's a caption element as well. You should also use the alt attribute on images
Might want to try the figure element https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure
If you want to add text on the picture, then css would probably help, check this one out: https://www.w3schools.com/howto/howto_css_image_text.asp
Also then you could just wrap the image in an <a> tag to make it a link like Hydragyrum said.
CSS can probably work some magic as well
Okay, thanks for the advice
Gave +1 Rep to @lime cape
Ok so I wanna make a program that grants admin privileges to another program, so it runs with admin privileges on startup
C++
Any way to do this?
It's for my own Rat
Just educational
Maybe for porting it to Linux and control my windows laptop that way
Yikes
@rotund palm Please do not ask malware development questions outside of the dedicated channels.
Which, for good reason, you don't have access to right now
hmm
How can I get access
Reach 0xD on tryhackme or obtain a relevant pentesting cert like OSCP or eCPPT
the heck?
Malware development has very few legitimate ethical uses
i see
do you know any ethical malware discord server?
"Malware" is never ethical
Offensive tradecraft / tooling uses many of the same techniques, but has ethical uses
Goodware then?
I think thats called software
Hi guys! I have a question about manipulating strings and characters in C language: basically my goal is to generating random 3-characters long password from a basic alphabet [a-z0-9]*, BUT my idea was to extract 3 chars from a string (the alphabet) to concatenate them in order to create a password but the problem is that I'm having the segmentation fault errors because of the type.
Any ideas guys?

Segfaults aren't because of types. Segfaults are because your program is accessing memory it doesn't have permissions to read or to write. String concatenation is almost always the wrong strategy in C, if you can share your code we can probably help you narrow down what's going wrong and help you understand why.
Thanks man I appreciate your help but for now I'm focusing more on the algorithm 'cause I have to create a program that cracks 3-characters long passwords
so I thought it's better to create a variable of type char[3] and extracting 3 characters from a dictionary to concatenate them in order to affect them to the variable
I hope I was clear enough lol
that's not concatenation if you have an array of length 3
How much do you know about C strings? Have you read the string.h docs?
From what you're describing, I think I can guess the problem. Reading the docs on string.h are probably going to be a 'doh!' moment for you
lol yeah maybe you're right
I'll read this
for example this function
what if I want to copy only one character?
the function forces me to use a string
lol
How about you start here: https://en.cppreference.com/w/c/string/byte
yeah what if I use the integer value of a character to "bypass" the problem lol
Or complete a network? That was mentioned in #start-here. Not sure if thst changrf
I believe specifically and exclusively throwback
Just says a network. If not, then that should be updated.
if characters can repeat, this is probably a bad solution, eg: is "aaa" a valid guess?
Yes
I'd focus on figuring out how to generate the strings in a brute-force attack
Yeah that's my problem lol
you know how ASCII works, yes?
Yes
a char is a fancy number π
should be able to generate the list with a loop
Hydra, there's another problem; so far, the segfaults have not been corrected for. IMO that's the first problem to solve, not the character problem.
well, probably several loops if you want the naive method
why are they segfaulting though?
Because they haven't understood how C strings actually work, as far as I can tell
ah right, they forgot the terminator
oh sure, spoil all the reading i was trying to foist off π
So in order to generate a password, should I use the ASCII trick?
naw
Oh
Strings in C are silly
Yeah lol
should probably be using std::string anyways rather than mucking with char arrays
oh wait, pure C
strike my last then
Because it's a lot older and a hell of a lot lower level
The lower level you go, the more power and control you have, but the harder it is to use
This is the exact reason I directed you to read the docs for C strings. The introductory paragraph on that link tells you exactly why you are getting seg faults.
hi a quick question do u know any good malware books?
if yes then please ping me when u answer so I can see it , Thanks
Hey is there a way in python with socket to RST a connection, without cancelling the script (then the same IP can connect again).
Here is my data that i'm sending : ** nc 192.168.8.21 12345 < data.txt **
here is the script of my server :
HOST = '192.168.8.21'
PORT = 12345
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
conn, addr = s.accept()
with conn:
print('Connected by', addr)
while True:
data = conn.recv(1024)
print(data.decode('ascii'))
What, for developing malware?
No one is gonna give you a book with instructions for doing illegal stuff smh
Maldev is fun tho @tulip sail
Hello. I am EisKaffe, I am using MailHog with Docker. Does anyone know how to customize MailHog's Web UI page? I want to add some CSS/JS. Thanks!
You should be able to close the socket
Have you checked their documentation?
Otherwise you'll probably need to rebuild the container
Its for just science reasons
@stable prairiehttps://www.amazon.com/Hacking-Art-Exploitation-Jon-Erickson-ebook/dp/B004OEJN3I
Doesn't exactly seem malware focused, does it?
Still Looks like a good boom
"Science" or "Education" is not an appropriate reason for developing weaponised software.
It's the same as trying to buy weapons grade uranium so you can build a bomb for a science project
Like the exploitation section there is really just bof and format strings, not maldev
Of course papas, James just loves to play devils advocate all the time.
...do you know what that means?
They asked for malware development books.
You provided a book that doesn't relate to malware development.
This isn't playing devil's advocate. I'm not advocating for any position. I'm simply posting the contents page of the book and showing that it doesn't relate.
Hes a level 1? Im assuming hes just delving into malware as a whole. This is a good starter book.
Please explain, if you will, how that book is related to malware?
It's basically a bof book.
Yikes.
Any time pal, good luck!
book*
A) THM levels mean very little.
B) Again, malware dev is not something we encourage.
C) Exploit dev != Malware dev
well no but actually yes
Which is why I linked him a book about exploitation rather than how to write malware right?
You try buying weapons grade uranium without getting arrested, I dare ya 
I wasn't answering his quesiton, I was giving him a suggestion based on the fact, im not going to link him a malware book.
hold my water
... Well, Okay then.
That'll be another kid will it
If you die from radiation poison then I'm not attending your funeral
idk whats so bad about writing malware like I know u can use it in a wrong way but when I use it in a good way its not bad
It's illegal, and THM doesn't advocate illegal activities.
There are no good uses for malware. Ever.
That's why it's malware
Offensive tooling / tradecraft, sure
Exploit dev, sure
Malware? Nope
ok
By definition it is "malicious software". It's designed to cause damage. There are no legitimate uses for that
well educational purposes to show how it works but still maybe then a malware analysis book
Malware analysis is a legitimate career, yes
ok so maybe I should try malware analysis
That book I linked is a great place to start.
Not for malware analysis, I'll be honest
I will give it a try
thanks for the link
Practical Malware Analysis: The Hands-On Guide to Dissecting Malicious Software
Michael Sikorski and Andrew Honig
Respectfully, Ill disagree. the book details a lot of the introductory logic behind malware and exploitation.
That's what I'd recommend. An actual malware analysis book.
You read the chapters, not even the book. Don't be so quick to diminish something you haven't read.
Don't be so quick to assume I haven't read it.
You wouldn't of pulled up the link if you had π€·
What?
bump
That's not a link. That's a contents page. How does that indicate I haven't read it? Surely being familiar with the content means I'm more likely to have read it?
I didnt add that I have nearly no skill in pentesting/ethical hacking/cybersecurity
Alrighty James, not in the mood for a hypothetical debate 
Don't worry, we noticed
Which is why I linked the starter book.
ye
Breaks down the theory of exploitation and all the steps involved rather than jumping into advanced malware analysis
ok
I will order it but I need to find it in eu
because I dont want to wait for a few weeks
ok thanks for help guys have a nice one
hello, I can't find idea how to align cells in the middle of a row (only html)
or in any given other size
@midnight perch In what environment? Excel? HTML tables? R?
don't look this things on it site π
tables html
what?
That's because it's a typo.
The align attributes have been deprecated with HTML5, so all formatting should be done in the CSS instead.
I can't use css
Then why are you using HTML.
I must it do without css cause I can't use css in homework lmao
This sounds like a question for your instructor, then.
Because styling anything outside of CSS is the exact opposite of best practices.
schools never teach practices
I doubt that she say something but thanks for time π
Gave +1 Rep to @magic falcon
Mine also did.
Hi Folks! A question: what exactly this part of code /.:/ means in TRUN call (in buffer overflow exercise) 'TRUN /.:/' ? Cannot be simply TRUN with a space 'TRUN '?
Hello folks! I really need your help: I coded a very basic function that cracks a hashed password of 3 characters long
Here the function I coded:
void crack_mdp_3(const char* alphabet, const char* hash)
{
int i=0;
char generation_mdp[4];
char salt[] = "$6$QSX8hjVa$";
while(i<strlen(alphabet))
{
int j=0;
while(j<strlen(alphabet))
{
int k=0;
while(k<strlen(alphabet))
{
//printf("%c%c - %s\n", alphabet[i], alphabet[j], generation_mdp);
generation_mdp[0] = alphabet[i];
generation_mdp[1] = alphabet[j];
generation_mdp[2] = alphabet[k];
generation_mdp[3] = '\0';
if(strcmp(crypt(generation_mdp, salt), hash) == 0)
{
printf("Mot de passe trouvΓ© : %s\n", generation_mdp);
i = 99; //condition d'arret
j = 99;
break;
}
else
{
printf("%s\n", generation_mdp);
}
k++;
}
j++;
}
i++;
}
return;
}
My goal is to come up with a recursive solution to crack a password of length n
btw the salt is given
do you have any idea guys?
feel free to ping me
So your goal is to generate words using alphabet with a specified length n?
yes
it's a basic dictionary
abcde...0123456789
the goal is to try all of the combinations
You can make some sort of word generation like so
char *generate_word(int n) {
const unsigned long alp_len = strlen(alphabet);
char *buffer = malloc(n + 1);
if (!buffer)
return NULL;
int i;
for (i = 0; i < n; i++) {
buffer[i] = alphabet[rand() % alp_len];
}
buffer[i] = '\0';
return buffer;
}
This will generate a random word of length n
the goal is to display all the possible combinations of generated password not generating a random one
for example, if we have a password 3-characters long, we start at aaa, aab, aac until 999
the problem for me is just how to generate all the combinations of password of length n
I'm hesitant to give you more help, when yesterday, I gave you a reference link to C strings and you asked more questions that would have been answered by reading the doc.
yes and I thank you for that
I read all the functions
really
but I still struggle to come up with a solution even if I tried by myself π
is this homework?
not at all
Gonna go out on a limb and say password hash cracking in C isn't hw lol
it's just to learn how to code my own tools to bruteforce stuff for CTFs in case of need
and I can't go forth without even understanding how can I code a basic program lol
hopefully there's this channel for help lol
Not trying to burst your bubble or anything but hashcat does password hashing VERY well I can see working with hashing in C a good learning opportunity but creating something that competes with hashcat would be extremely difficult
You'd be surprised - I had a prof give a very similar assignment for an undergrad course on security
Really? Lol I wish I went to that University π
yeah you're right man but my goal is not to code a tool to compete with hashcat lol
damn
Well, I gave you another concept to go look up and understand. Here's another clue that may help: ASCII character set
OMG!
Oh, and permutation of a selection from a set
eureka moment
@magic falcon you're a fucking genious!
lol
I think I'm getting close to the solution
I don't know about that. I know a few things, and for the things you are asking about, I think there ought to be a healthy amount of pain to reinforce what you're learining
man I could exploit the ASCII values to shift from one character to one another
with a loop
without using pointers or whatever
Unfortunately in order to specify a size you're going to need to malloc which will result in working with pointers
It's just the nature of C pointers are everywhere π€·
yeah true
However yes this problem is just a general programming problem not particular to C I definitely recommend looking at the algorithms needed for creating permutations of a set as mentioned above
Hi
Is there anyone who have worked with WhatsApp api or something like implementing a functionality to send and receive Messeges from WhatsApp using python node.js etc
hi, any one a bash wiz,
ββ$ decode64s "$(encode64s "hello")"
hello
βββ(γΏOSError-14)-[~/DotFiles]
ββ$ encode64s "hello" | decode64s```
if i have two bash scripts (above as example) why do the scripts not like piping
@dawn stag how are you reading input in the decode64s script?
You can use /dev/stdin to read from standard input
b64decode()
{
if (( $# == 0 )) ; then
base64 --decode < /dev/stdin
echo
else
base64 --decode <<< "$1"
echo
fi
}
Ta
@woeful badge probably best to discuss in here
meoww
What exactly are you trying to do?
Looks like you're trying to rotate things in a 3d space
So the best way to do this is to generate the transformation matrix
uhh
Those, yeah
idk what it mean
The matrix will transform your vector into a new vector
If you just want the rotation you can use a 3x3 matrix
A point can be considered a vector from the origin to the point
oki
You'll have x, y, and z components
like dis?
google didnt tell me what that was
oh wait it in a dictionary
im too lazy to fix the code im gonna keep it as cord
You have 6 degrees of freedom, that is you can move on 6 different axes: translation along x, y, and z as well as rotation around x, y, and z
currently just x and y
For that you need to maintain position and orientation
z is typically the up-down direction
oh
Or in to and out of in graphics
I googled xyz and it said y is up/down so I put that in the code
Oh that's the graphics definition then
I'm doing server and client apps in python (for chatting). They both need threading, do you suggest any library other than _thread?
whats the difference between the graphics and th other thing
Multiprocessing
Physics and engineering define it a bit differently
oh
Thanks
Gave +1 Rep to @brazen eagle
But that doesn't matter, what's important is that you're consistent
O.o
:(
Wait I think I was thinking of another lib
I saw the same lib for threading so I might as well try
Wait or not
π₯΄
Threading is similar to multiprocessing, I'll try this one lol
Err that's unfortunate?
I'd recommend you start in the 2d plane with only x and y
That can be extended easily enough
can stack follow fifo order ? ik it follows Lifo but isthere any way to follow fifo in stack ?
would it be a stack if it did?
Yeah that would be a different structure
If you need both operations, then look at deques.
Otherwise you'll be wanting a queue
They are synonymous.
IMO you should never talk about FILO, it just gets confusing π
Unless it's pastry
hello guys got question , we started with php but i have no idea how to connect my php code with html one , with css we did <link rel="stylesheet" href="(my css file name)"> , is it same with php or no?
PHP inlines it's code, no?
Hi guys
I would like to program in python and I read some advices to use librairies that I don't knwo...
How could I evaluate their security??
Most are open source
the best way is to learn fundamentals first, then you learn whatever library that serve your needs
yes but is it really not dangerous??
What do you mean?
I'm not a newbie in programming you know...?
In theory it can be. You always need to place a certain level of trust in anything third party you're using.
That'll be for you to analyse and determine
That's why I ask if there is a way to "check it quickly" π
There's no way to check it out quickly.
When high-profile libraries are used, they might still not be safe to use. As James said, it's rare they have malware, but it happens.
sry I misunderstood
No problem π
Using a third-party library is always externalising the risk. You're betting on them to be benevolent (and competent enough π )
in order to evaluate the security of a specific library, you have to check it line by line (the best way is to use libraries just from the official pip repository)
I tried to restrict but I'm not that confident in pip π
getting your code to pip isn't really a proof of anything.
I'm a bit parano I gess
You know anyone can public to pypi right?
what
I thought python developers check the package before it is published
there are some characteristics that can be caught by static analysis of the code, as well.
Most popular packages are probably alright
There were a few pypi packages that had malware; taht was big news recently. I would recommend at the very least running any library through a SAST tool
Getting access to one might be a problem, though. There are open source ones, sure, but their SNR is pretty low.
SonarQube is pretty good, from what i remember of the 1 project that used it
Pretty wide language coverage, DoD accepted
Sonarqube is getting more and more security rules
There's also snyk apparently
Might be more for containers though
looks like snyk has multiple products
big difference between container security scan and source code scans, though
I think Snyk's free tier is mostly about dependency and container vulnerabilities.
they say they have 'open source code scan' at that tier as well
but the docs AFAICT don't really describe what that means
So it seems. No idea what that really stands for.
best way to practically learn python and java script?
Use it
I don't knw what to begin with
ok my problem is i am programing chess in java and i used Jlabels to make the Patches and setting an imageicon to display the figures but but once i am running it only a part of the figure appears in the Jlable and i hava no idea why this is happning
Oh no, Swing.
Guys do you also hate maths but love programming related maths?
No, I enjoy both
weird

What is programming related math? Boolean algebra ?
i dislike snyks stuff for open source
Would you like to elaborate? π
it cries about licensing issues then when i look into them, it's actually wrong
they're just lying to get open source creators to make accounts
like this
if i make an account there are no high risk license issues
they're lying to get me to make one
Eh. That sucks.
What about the licenses, do they get those right for an identified component?
identified component?
they find a library, do they identify its licenses correctly?
i mean it's not that hard as it's built into github / package managers π
so i'd hope so
I guess the biggest issues in that come from multi-licensed components.
some libraries e.g. in java world are multi-licensed with EPL/LGPL3/Apache/whatever, and that's where at least triaging gets hard.
and with maven/gradle, the licensing information might be there. Or then it's not.
Anyway, where would their valuation come from if not from a huge customer base? π
I like synk for work ngl. At least for flagging up vulns in a specific version of jquery etc
Natsu wishes to find Igneel, the dragon who is like a father to him. But in order to find him he has to
complete certain number of tasks. Tasks are defined by string of lowercase english alphabets and
he may be asked to complete a same task more than once. He has a list of N tasks. But he wants to
complete the tasks which occur multiple times together. Also he wants to complete the tasks which
occurs least frequently first. If two tasks have same frequency the lexicographicaly smaller will be
completed first. Help him prepare such a list representing frequency of tasks and task name
separated by a space.
Constraints:
1 β€ T β€ 10
1 β€ N β€ 10000
1 β€ | Task| β€ 10
Input:
First line contains the number of test cases T. For each of the T test cases first line is number N the
number of Tasks followed by N strings of lowercase english alphabet.
Output:
For each test case output the list as explained above.
SAMPLE INPUT
1
10
abcd
bcd
abc
abc
abc
bcd
bge
dbaa
bcd
bge
SAMPLE OUTPUT
1 abcd
1 dbaa
2 bge
3 abc
3 bcd
anyone pls??????????????
want cpp solution
This looks like a homework question
Well, you better get started on it.
For the record, we do not help with homework in general
I'm thinking of doing Advent of Code with rust. It might motivate me to learn a bit of it.
What's this for? @worldly iris
And are you asking just to see how people would solve it themslves?
i dont think my code will work on all cases
Find some cases it wouldn't work in then
Also I would change it from arr to list in your function
No no no no
List is a python type.
Yes yes yes yes
Bad
k
List is the name of the type. Calling the parameter list would be very bad
Just change it from array
k is a terrible variable name too but that's what they used in the q
Can you drop that test case here in text?
I have a shorter but infinitely worse version
Just that print line at the bottom, line 13
print(missing_nos([0, 1, 2, 4, 5, 6, 7, 8], 2))
def missing_nos(arr, k):
return sorted([num+1 for num in arr if num+1 not in arr][:k])
print(missing_nos([0,1,2,4,5,6,7,8,10], 2))
@onyx merlin this works, right?
I honestly couldn't tell because it looked too simple to work LMAO
@worldly iris drop the link to the challenge pls
Python is just spicy and can do stuff you'd not expect
No, bad Jabba. list is a type, and while python can name a variable list, this will cause a collision that makes the list keyword uncallable
it's bad naming for this problem, for sure
Thinking similar but i'll go with golang, so rusty (pun not intended)
I have chat app and when client sends #GAME_START to the server, the game should start for all of the clients and they should be all able to guess.
def handle_client(self, client):
while True:
if self.gamemode == True: # gamemode is server bool variable
self.game(client) # this doesn't work
continue
body = ""
servermsg = ""
clientmsg = self.recv(client)
# Sets the body of client msg if exists
if clientmsg and len(clientmsg) > 1:
body = clientmsg[1]
else:
continue
# Do stuff based on HEAD option
if clientmsg[0] != Head.QUIT.value and clientmsg[0] != Head.GAME_START.value:
servermsg = f"[{self.clients[client]}] {body}"
self.send_all(Head.MSG.value, servermsg)
elif clientmsg[0] == Head.GAME_START.value:
servermsg = f"** {self.clients[client]} je zacel igro!"
self.send_all(Head.GAME_START.value, servermsg)
self.gamemode = True
# self.gamemode(client)
else:
client_name = self.clients[client]
self.clients.pop(client)
self.send(Head.QUIT.value, "Success", client)
self.send_all(Head.MSG.value, f"*** Uporabnik {client_name} je odsel. Ciao bella.")
break
This is a thread function from server-side. What am I doing wrong?
Not describing your problem properly?
can someone help me with my python RSA H.W plz xD
Again. We don't do homework help here. Ask your teacher.
sry james but my teacher isnt helping thats why i came to ask
π¦
Ooof
Use google?
google is useless xD
Shameless self-plug but that might help
Now that sounds like a layer 8 issue
ofc not always but it was useless this time xD
Mmm thats sad haha
noooo comeon :))))))))))))
Ok. I've just spent an entire hour hunting for the damn bug when after all it turns out that....
Just goes to show, K&R is still an essential reference
The more stuff I am asked to do with C the more I start understanding all the hype and hope that Rust is generating
screw dangling pointers and all that stuff
It answers the right questions
Hello
This maybe silly, but I am having a hard time understanding the purpose of return in Python for functions?
Imagine you call a function like this:
numberVariable = generateNumber()
after the function finishes, it should return something if you want that something to be used by whatever called the function.
okay, i see
you can actually NOT implement a return inside the function. Let's say something that just prints numbers:
def printNumber(numVar):
print(f"Your number is! {numVar}")
btw there are no silly questions when you are learning π Ask whatever you want!
thank you very much @lilac holly π
Gave +1 Rep to @sage eagle
I'm not sure what you mean by this, could you explain?
Sure! It's not a requirement to implement return on every function you code. Some people like to just write "return" without anything at the end of the function though (Although that is also not required - in python -)
Ah, I see π
only if the function returns void
Anyone doing Advent of Code?
This in C, right? (Also: Are there any other languages where functions can return void??)
every function returns something, by definition. IIRC, languages that don't require return explicitly, have an implicit return of 0
nothing useful then
what is a good "black hat" python3 guide ?
The black hat python book written by justin seitz π As far as I know there's nothing like it out there...
is there a version with python3?
then i will look for it better
Yeap. The lastest edition is in Python3
i see. Thanks)
Gave +1 Rep to @sage eagle
that's the one currently on humble as well, ye?
Yeap exactly the same one!
also, unit tests are good π
test("Given an application When we access an authenticated route with an unsigned token Then we get a 401") {
withApplication(getJavaMachineEnv()) {
with(handleRequest(HttpMethod.Get, "/hello") {
val token = JWT.create()
.withAudience("jwt-javamachine")
.withIssuer("http://javamachine.thm/")
.withClaim("username", "Hydra")
.withArrayClaim("roles", arrayOf("User"))
.withExpiresAt(Date(System.currentTimeMillis() + 60000000))
.sign(Algorithm.none())
addHeader("Authorization", "Bearer $token")
}) {
response shouldHaveStatus HttpStatusCode.Unauthorized
}
}
}
ain't gonna be downgrading JWTs on my watch
Oh man I need to do an API + Auth programming course asap
got any recommendations or blogs where I could get some solid quality info?
I'm just scraping whatever I can find off google and trying to slap things together, but it's nowhere near robust
everyone's handing auth off to third-party SSO providers
that said, Keycloak is a pretty good on-prem solution if you want FOSS
Is it possible to use winsock2.h library when programing in c on linux?
It's probably possible, but that sounds like it's platform specific to windows
You can probably copy the header over but I doubt the DLL will work
Why would you want to? If youβre network programming for Linux use Linux sockets
If youβre coding for windows on Linux then you can but youβll need to install a cross compiler like mingw-w64
and that's what I was doing
I installed it and it didn't work
It should work but the compiler isnβt called mingw-w64 as thatβs just the toolset name
I'll take a look
Hello everyone, as a beginner what do u suggest as far as writing scripts ....i do not wanna be a script kiddie ππ€£π no really tho
When you start writing a script, take a bit of time and write some comments about what you want the script to do, and what it should output or return. Having a plan makes the actual writing part much easier.
Wat. No u just wget from exploits.org
@magic falcon thanks
Gave +1 Rep to @magic falcon
Sorry wrong one
That one
Many of those books are not suitable for beginning to learn to program - picking up more advanced concepts like that will confuse beginners.
Yeah I grabbed the wrong bundle.
Automate the Boring Stuff with Python: Practical Programming for Total Beginners https://g.co/kgs/AGhMhF
That one is better for beginner
@empty ridge thanks
Gave +1 Rep to @empty ridge
Its crazy i can read code but writing and being able to explain it is another story @magic falcon @empty ridge
If you can read source code but not explain it, you aren't really reading it.
That would be like reading a story and not being able to summarize what the plot was.
I had an interview for a web dev job....couldnt even explain my own code i just know it worked if tht makes any sense
That does not. If I was interviewing a coder who couldn't explain their code, I wouldn't hire them.
They didnt - i told them alot of people cant read the sign that say bathroom.... don't mean they don't know how to use one ππ€£π
Did you really?
Absolutely
An answer like that in an interview would blacklist you from every panel for that kind of role
that I would sit on
Life is short...i have fun
For employement, single biggest skill you can cultivate that has value is communication.
90% of working any security role, either red or blue team, is producing and handling documentation.

I was looking at the popular programming languages on TIOBE and I see this long term table :
Python's is impressive
cheers for SQL in all CAPS
lol
Yes, post your problem
Or don't I guess
He chose to DM me without permission instead, so he was ignored π€·ββοΈ
Hello all I have a question
So in my career so far, I have stuck with cybersecurity analyst positions, mostly blue team stuff and log analysis, but no coding.
At my current job they differenciate cybersecurity analyst and engineer by the engineers doing code and analysts using those tools to look at logs and other things.
A lot of the requirements for this "engineer" position include (examples):
-
Coding/scripting experience in one or more general purpose languages to automate detections (python)
-
The candidate must be able to use code to automate investigative actions and have a proficiency in scripting languages such as PHP or Python
I have general knowledge of coding, but my question is -- is this like a specific niche of coding? (Being able to automate investigative actions using Python) if so, how long would it take to learn and is it more complex than just learning that niche?
Hi @azure peak! What do you mean by "general knowledge of coding"? Do you actually know how to code? What programming languages do you know?
Bare minimum to understand Logic of python, can not code a program past simple logic or anything like that. Learned from a university class covering like arrays or boolean and simple stuff like that, nothing hands on
Perfect. Now I understand your situation better. Well, very likely -since they are asking for Python or PHP and given that I don't have more info at the moment- it's to script using APIs exposed by the tools/solutions your team is using (think of it for now as being able to tell a running program or service to spit out the information you need and be able to consume/use it as you want).
Also very likely, that will also involve gluing together the info of many solutions and do something with it.