#programming

1 messages Β· Page 31 of 1

winged magnet
#

n i m using this mysql-connector-java-5.1.42.jar

brazen eagle
#

Does it work?

winged magnet
#

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"

dusty ore
#

Guy s I have a question

#

I have no idea why the outputs are different

#

I thought they are the same thing?

magic falcon
#

List comprehensions build a list.

dusty ore
#

I see

magic falcon
#

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.

dusty ore
#

Oh I see

#

Thanks I understand now

solar hull
#

Are you providing a port number for the service? (Just guessing based on the error message showing the String Port)

brazen eagle
#

missing some slashes, no?

brazen eagle
#

the slash after localhost normal?

leaden berry
brazen eagle
#

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

kind igloo
#

Thanks

wispy kestrelBOT
#

Gave +1 Rep to @heavy rampart

keen jetty
#

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)

keen jetty
onyx merlin
#

It's under / by default?

keen jetty
#

This one is in an an "img" folder. I want to be able to find it regardless of what the file path is.

onyx merlin
#

Do NOT parse HTML with regex.

keen jetty
#

Yeah I've gone back to beautiful soup and I'm going to try and get that to work

thin coral
#

can anyone help me how to improve problem solving in programming

onyx merlin
thin coral
wispy kestrelBOT
#

Gave +1 Rep to @onyx merlin

onyx merlin
#

Please don't call me bro

thin coral
#

oh sorry

sly breach
#

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

wispy kestrelBOT
#

Gave +1 Rep to @hollow tangle

brazen eagle
keen jetty
brazen eagle
#

for example:

fickle siren
polar rock
#

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

drowsy pelican
brazen eagle
polar rock
brazen eagle
#

I'd assume bash for one :p

#

Without knowing what the script does though

polar rock
#

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)

brazen eagle
#

Ok

#

Could it be the os attempting to fortify against guessing the next pid? Otherwise I'd probably ask google :)

polar rock
#

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)

polar rock
brazen eagle
#

One probably shows the array, and the other a string representation?

polar rock
#

umm just a sec, ill try it out practically

#

PARRRFFAACCTTT

brazen eagle
#

Cool

polar rock
#

sadly IFS is limited to 1 char only... (so no escape characters can be used \n \t)

#

this was nice ❀️ thx @brazen eagle

wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

brazen eagle
polar rock
#

it is... but like, if u have to specify \n it's 2 characters as a string

brazen eagle
#

Pretty sure env vars escape, or what about wrapping it in quotes?

polar rock
brazen eagle
#

Single quotes don't eacape

polar rock
#

nooo this was the script

brazen eagle
#

Try double

#

Ah

polar rock
#

yeaa, i just saw the -x (debug switch) encloses the output in single quotes

brazen eagle
#

Well darn

polar rock
#

yee πŸ˜† sorry

#

i should've seen it first

brazen eagle
#

Apparently it's IFS=$'\n'

polar rock
#

in the second one, I tried with the $ sign in front of it, it didn't show any change

brazen eagle
#

Or

IFS="
"

May also work

#

Single quotes on the inline one

polar rock
#

genius

brazen eagle
#
#

For the record

polar rock
#

😱 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

drowsy pelican
polar rock
#

thx ❀️ will surely check out

neat ocean
#

Can someone help me figure out why I am getting this error?

stoic badger
#

The error explains exactly what's wrong

pine jungle
stoic badger
#

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.

neat ocean
#

No. I'm importing the whole module.

#

In my interpreter I don't get the same error

neat ocean
stoic badger
#

huh

#

weird

#

Can't help if I don't know what the code looks like πŸ€·β€β™‚οΈ

magic falcon
#

Check that your .py file is trying to execute as py2 and not py3. This looks like a library location problem.

stoic badger
#

yeah didn't think about that one

neat ocean
pine jungle
#

why dont you run

magic falcon
pine jungle
#

python3 {PYTHON_SCRIPT} {TARGET_IP}

neat ocean
#

im so confused

magic falcon
#

Check that the .py file also uses the Queue module exactly the same what you ran in your interpreter.

neat ocean
# magic falcon Ok, so in your .py file there should be a line that tells your file what python ...

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 *

magic falcon
#

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.

neat ocean
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

tulip sail
#

Doesn't look like it.

#

That's with just import queue in Python3

lethal wharf
#

anyone good in java can dm me rq plzz?

lethal wharf
#

Huh?

polar rock
brave pulsar
#

@polar rock Nah, it's just something we link people to when they ask questions like that.

crystal light
#

It’s an awesome site haha

polar rock
#

ohh, so one of u guys own it? (tryhackme people)

brave pulsar
#

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?

polar rock
#

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

polar rock
crystal light
lethal wharf
# polar rock no coz I read this... whitetiger asked the question about java... and the site's...

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

polar rock
magic falcon
#

is this project one you are being paid for, or for a course?

lethal wharf
#

No it's for a course

lethal wharf
neat ocean
#

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?

magic falcon
#

You don't 'call a class'. @neat ocean What language are you working in, and what are you trying to do?

neat ocean
magic falcon
#

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.

neat ocean
#

Wouldn't that mean that all defind functions should run?

magic falcon
#

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?

neat ocean
#

self being the object correct?

magic falcon
#

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

neat ocean
#

This is really the only thing left that I don't have a great understanding of

magic falcon
#

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?

neat ocean
#

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.

magic falcon
#

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

neat ocean
#

oh okay that makes sense.

#

So why in my code would init run automatically if the instance wasn't called?

magic falcon
#

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

neat ocean
#

I'm going to reiterate what I believe your saying.

#

I'm a bit confused

magic falcon
#

there is also a difference the abstract purity of what i'm talking about and how python interpreters take your module and use it.

neat ocean
#

The constructor is init correct?

magic falcon
#

The constructor is the special method that gets invoked to 'build' the object from the class

#

In python, that's the special __init__ function

neat ocean
#

So the constructor gets called immediately once the class is created?

magic falcon
#

No

#

It gets called when you instantiate an object

neat ocean
#

example = workerExample() <--- This is what you mean by that correct?

#

or do you mean at this point example.run()

neat ocean
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

magic falcon
magic falcon
neat ocean
eager gulch
#

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.

neat ocean
eager gulch
#

thank you

polar rock
eager gulch
#

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)

polar rock
#

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

dusty ore
#

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 ?

magic falcon
#

So you have a project you have an idea for, but you are having problems implementing it?

dusty ore
#

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

magic falcon
#

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

dusty ore
#

I see

#

But I don't realy know how to, I thought that was the simpliest way of doing it

magic falcon
#

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?

dusty ore
#

No...

magic falcon
#

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?

dusty ore
#

I don't

#

The term is kinda weird, lemme google it

magic falcon
dusty ore
#

At first glance, looks like its OOP am I wrong?

magic falcon
#

You are wrong

dusty ore
magic falcon
#

UML is a way to visualize your problem space, OOP can be represented in UML, but UML is much more than that.

dusty ore
#

I see

magic falcon
#

You can use it to visualize sequencing, timing, state transitions, complex interactions, control flow, data flow, and overall system architecture

dusty ore
#

ohh

magic falcon
#

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'

dusty ore
#

I see, imma have it a read

#

Thanks!

magic falcon
#

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

dusty ore
#

Thank you, I think imma read it and see if I can break down the problem into small parts then solve it

magic falcon
#

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

lethal wharf
# lethal wharf https://github.com/Hackorme/Computer-Security-Project

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

eager gulch
#

What tags do I need to use to post a small section of code?

cursive orchid
eager gulch
#

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"

magic falcon
#

From the snippet you ahve posted, nothing is returned. The from the behavior you are describing, that matches the code as it is.

stoic badger
#

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

eager gulch
#

I see.

#

yes it is not printing the way I want it to.

#

or the way it should, i should say.

stoic badger
#
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

eager gulch
#

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

stoic badger
#

np

tulip ibex
#

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

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.

tulip ibex
#

ah would take dat suggestion and keep in mind thanks

solar hull
tulip ibex
#

oh freak my bad thanks for corrrecting it

plucky helm
#
# walrus operator, is it good or meh?
while (answer := input()) != "WALL-E":
    .
    .
    .
exotic skiff
#

anyone here good with sdl in c++?

magic falcon
#

Last time I touched SDL was ~6 years ago. Please just ask your question, and don't ask to ask.

winged magnet
#

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.

brazen eagle
#

Don't think you can do math like that in a query

crude chasm
#

Ofcourse you can, you can do alot of crazy stuff in SQL πŸ™‚

#

But the example itself has errors

crude chasm
rapid meadow
#

Can someone suggest a good resource for advanced coding/competetive coding?

fickle siren
#

There are also plenty in the pins

polar rock
polar rock
#

The second e -> o

#

What kind of marketing could that be?

fickle siren
#

Exercise -> Exercism. It's not related to exorcism

polar rock
#

Ik, but it's just soo closeπŸ˜… sorry

solar hull
#

Do you think it's not intentional?

polar rock
#

But thats creativeπŸ˜„

frank mango
#
>>> 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 ?

tulip ibex
#

try print(out)

plucky helm
#

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

frank mango
#

Okay thanks i will tey it out.

#

Try

polar rock
#

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

near forge
#

is there anyone to help me about uml diagrams

magic falcon
#

Just ask the question

near forge
#

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

brazen eagle
#

you know what a class diagram is supposed to show, yes?

lilac holly
#

Can someone recommend a challenge that'll include quite some code review needed in languages such as javascript or php?

placid goblet
#

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?

modern talon
#

Ah, you're already here.

#

Make sure to look at the useContext hook as well. I think it's used more for 'global' state, but I might be wrong.

placid goblet
#

Ok bro, thanks for the references

modern talon
#

Np

lilac holly
#

If A2.js is a direct child of A1.js then you can just pass props if not then redux or context

plain path
#

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

brazen eagle
#

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

surreal ridge
#

hey anyone of you have experience interviewing with amazon for SDE profile?

surreal ridge
worn stump
valid fern
#

SDE is software development engineer right?

surreal ridge
surreal ridge
magic falcon
#

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.

solar hull
#

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.

brazen eagle
placid goblet
#

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?

brazen eagle
#

Are those from webauthn?

placid goblet
#

yup

brazen eagle
#

Api should already be implemented in the browser

#

You may need to do some work server-side

placid goblet
#

For this do we need to create API for those 3?

#
Amazon Web Services

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

brazen eagle
#

I'd assume aws has an implementation

midnight perch
#

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

winged magnet
#

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.

limber wasp
#

Remove the full keyword

onyx merlin
midnight perch
onyx merlin
#

You can set a proxy for the whole network and tunnel everything through it. That's what schools do for MITM and monitoring.

midnight perch
onyx merlin
#

You have to install a cert on the end device

midnight perch
#

VPN is fine but specifically the proxy is a no go

onyx merlin
#

And if you don't own the device, you should not be attacking it.

midnight perch
#

He fully consents to it, i can prove that if needed πŸ˜‡

onyx merlin
#

You got a full legal contract?

midnight perch
#

what?

onyx merlin
#

You'd be surprised how much trouble people can kick up

midnight perch
#

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

onyx merlin
#

Bug bounty is different because you have a contract through that

#

It's certainly not a living in most countries

midnight perch
#

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? πŸ˜‹

midnight perch
#

:( having so much fun testing their security

lilac holly
#

!rank

brazen eagle
eager gulch
#
  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

sturdy sentinel
#

Hello. Any python students or professionals here?

stoic badger
sturdy sentinel
stoic badger
#

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

bold plank
#

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

remote crag
#

is this for a CTF?

bold plank
remote crag
#

hmmm

#

you might want to check where the exception's occurring first

#

i see 2 very likely spots where it could come from

bold plank
#

It was occuring in two spots seemingly randomly

#

Depending on the inputted string

#

I couldn't figure out a pattern at the time

remote crag
#

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

bold plank
#

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

remote crag
#

you could also try rewriting this code in Python line-by-line

#

the issue might be more easily discovered that way

magic falcon
#

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.

brazen eagle
#

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

tranquil quartz
#

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'

true pumice
#

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

tranquil quartz
#

@true pumice thanks

wispy kestrelBOT
#

Gave +1 Rep to @true pumice

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

bold plank
stoic badger
#

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

mystic prairie
#

hey guys

stoic badger
#

We all do at some point

#

I still do kekw

brazen eagle
burnt elbow
#

hello

#

does anyone now something about python and want to help me with a project?

fading lark
#

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

midnight perch
#

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>

brazen eagle
#

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

lilac holly
#

Also then you could just wrap the image in an <a> tag to make it a link like Hydragyrum said.

brazen eagle
#

CSS can probably work some magic as well

midnight perch
wispy kestrelBOT
#

Gave +1 Rep to @lime cape

rotund palm
#

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

true pumice
#

Yikes

onyx merlin
#

@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

onyx merlin
#

Reach 0xD on tryhackme or obtain a relevant pentesting cert like OSCP or eCPPT

rotund palm
#

the heck?

onyx merlin
rotund palm
#

i see

rotund palm
tulip sail
#

Offensive tradecraft / tooling uses many of the same techniques, but has ethical uses

glacial sky
#

ethical malware lol

#

love that guy

rotund palm
warped axle
#

I think thats called software

sage walrus
#

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?

brave pulsar
magic falcon
sage walrus
#

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

magic falcon
#

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?

sage walrus
#

a little bit

#

I mean I know that a string is an array of characters

magic falcon
#

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

sage walrus
#

lol yeah maybe you're right

sage walrus
#

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

magic falcon
sage walrus
#

yeah what if I use the integer value of a character to "bypass" the problem lol

fickle siren
onyx merlin
fickle siren
#

Just says a network. If not, then that should be updated.

brazen eagle
sage walrus
#

Yes

brazen eagle
#

I'd focus on figuring out how to generate the strings in a brute-force attack

sage walrus
#

Yeah that's my problem lol

brazen eagle
#

you know how ASCII works, yes?

sage walrus
#

Yes

brazen eagle
#

a char is a fancy number πŸ˜‰

sage walrus
#

Yeah I know

#

I can use atoi()

#

For example

brazen eagle
#

should be able to generate the list with a loop

magic falcon
#

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.

brazen eagle
#

well, probably several loops if you want the naive method

#

why are they segfaulting though?

magic falcon
#

Because they haven't understood how C strings actually work, as far as I can tell

brazen eagle
#

ah right, they forgot the terminator

magic falcon
#

oh sure, spoil all the reading i was trying to foist off πŸ˜›

sage walrus
#

So in order to generate a password, should I use the ASCII trick?

brazen eagle
#

naw

sage walrus
#

Oh

brazen eagle
#

Strings in C are silly

sage walrus
#

Yeah lol

brazen eagle
#

should probably be using std::string anyways rather than mucking with char arrays

#

oh wait, pure C

#

strike my last then

sage walrus
#

I'm still confused lol

#

Why couldn't C be like Python

tulip sail
#

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

magic falcon
#

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.

sage walrus
#

Yeah you're right

#

I read the docs

#

Thanks man

#

I appreciate it

stable prairie
#

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

true pumice
bright trail
#

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')) 
tulip sail
cold cloak
#

Maldev is fun tho @tulip sail

normal bluff
#

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!

brazen eagle
brazen eagle
#

Otherwise you'll probably need to rebuild the container

stable prairie
earnest thicket
onyx merlin
stable prairie
#

Still Looks like a good boom

tulip sail
# stable prairie Its for just science reasons

"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

onyx merlin
#

Like the exploitation section there is really just bof and format strings, not maldev

earnest thicket
#

Of course papas, James just loves to play devils advocate all the time.

tulip sail
#

Does he? I hadn't noticed πŸ™‚

#

That was serious.

onyx merlin
#

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.

earnest thicket
#

Hes a level 1? Im assuming hes just delving into malware as a whole. This is a good starter book.

onyx merlin
#

Please explain, if you will, how that book is related to malware?
It's basically a bof book.

earnest thicket
#

Yikes.

earnest thicket
stable prairie
#

book*

tulip sail
earnest thicket
#

Which is why I linked him a book about exploitation rather than how to write malware right?

tulip sail
earnest thicket
#

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.

tulip sail
#

... Well, Okay then.
That'll be another kid will it

fickle siren
#

If you die from radiation poison then I'm not attending your funeral

stable prairie
#

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

earnest thicket
#

It's illegal, and THM doesn't advocate illegal activities.

tulip sail
#

Offensive tooling / tradecraft, sure

#

Exploit dev, sure

#

Malware? Nope

stable prairie
#

ok

tulip sail
#

By definition it is "malicious software". It's designed to cause damage. There are no legitimate uses for that

stable prairie
#

well educational purposes to show how it works but still maybe then a malware analysis book

tulip sail
#

Malware analysis is a legitimate career, yes

stable prairie
#

ok so maybe I should try malware analysis

earnest thicket
#

That book I linked is a great place to start.

onyx merlin
#

Not for malware analysis, I'll be honest

stable prairie
#

thanks for the link

onyx merlin
#

Practical Malware Analysis: The Hands-On Guide to Dissecting Malicious Software
Michael Sikorski and Andrew Honig

earnest thicket
#

Respectfully, Ill disagree. the book details a lot of the introductory logic behind malware and exploitation.

onyx merlin
#

That's what I'd recommend. An actual malware analysis book.

earnest thicket
#

You read the chapters, not even the book. Don't be so quick to diminish something you haven't read.

onyx merlin
earnest thicket
#

You wouldn't of pulled up the link if you had 🀷

onyx merlin
#

What?

earnest thicket
onyx merlin
#

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?

stable prairie
#

I didnt add that I have nearly no skill in pentesting/ethical hacking/cybersecurity

earnest thicket
#

Alrighty James, not in the mood for a hypothetical debate kekw

earnest thicket
stable prairie
earnest thicket
#

Breaks down the theory of exploitation and all the steps involved rather than jumping into advanced malware analysis

stable prairie
#

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

midnight perch
#

hello, I can't find idea how to align cells in the middle of a row (only html)

#

or in any given other size

sage walrus
magic falcon
#

@midnight perch In what environment? Excel? HTML tables? R?

midnight perch
sage walrus
midnight perch
#

can't*

#

see

magic falcon
#

That's because it's a typo.

sage walrus
magic falcon
#

The align attributes have been deprecated with HTML5, so all formatting should be done in the CSS instead.

midnight perch
#

I can't use css

magic falcon
#

Then why are you using HTML.

midnight perch
#

I must it do without css cause I can't use css in homework lmao

magic falcon
#

This sounds like a question for your instructor, then.

#

Because styling anything outside of CSS is the exact opposite of best practices.

midnight perch
magic falcon
#

Mine did.

#

So you should ask for instructor for guidance.

midnight perch
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

onyx merlin
warm lily
#

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

sage walrus
#

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

hollow tangle
sage walrus
#

yes

#

it's a basic dictionary

#

abcde...0123456789

#

the goal is to try all of the combinations

hollow tangle
# sage walrus yes

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

sage walrus
#

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

magic falcon
#

Characters are ordinal in C.

#

That's a big clue for procedural word creation

sage walrus
#

wdym? πŸ˜…

#

I'm sorry

magic falcon
#

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.

sage walrus
#

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

magic falcon
#

is this homework?

sage walrus
#

not at all

hollow tangle
sage walrus
#

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

hollow tangle
magic falcon
hollow tangle
sage walrus
magic falcon
#

Well, I gave you another concept to go look up and understand. Here's another clue that may help: ASCII character set

sage walrus
#

OMG!

magic falcon
#

Oh, and permutation of a selection from a set

sage walrus
#

eureka moment

#

@magic falcon you're a fucking genious!

#

lol

#

I think I'm getting close to the solution

magic falcon
#

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

sage walrus
#

man I could exploit the ASCII values to shift from one character to one another

#

with a loop

#

without using pointers or whatever

hollow tangle
#

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 🀷

sage walrus
#

yeah true

hollow tangle
magic falcon
#

Yes

#

That's more to the underlying maths of crypto and CS though

vague sedge
#

Hi

restive knot
#

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

dawn stag
#

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
dire vortex
#

@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
}
dawn stag
#

Ta

brazen eagle
#

@woeful badge probably best to discuss in here

woeful badge
#

meoww

brazen eagle
#

What exactly are you trying to do?

woeful badge
#

idk

#

I had idea to make thingy so I did

#

im just adding stuff as I get more idears

brazen eagle
#

Looks like you're trying to rotate things in a 3d space

woeful badge
#

and move them

#

it seems to work

brazen eagle
#

So the best way to do this is to generate the transformation matrix

woeful badge
brazen eagle
#

Those, yeah

woeful badge
#

idk what it mean

brazen eagle
#

The matrix will transform your vector into a new vector

#

If you just want the rotation you can use a 3x3 matrix

woeful badge
#

uhh

#

its more of a point

brazen eagle
#

A point can be considered a vector from the origin to the point

woeful badge
#

oki

brazen eagle
#

You'll have x, y, and z components

woeful badge
#

like dis?

brazen eagle
#

Yes

#

Generally say coord though

woeful badge
#

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

brazen eagle
#

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

woeful badge
#

currently just x and y

brazen eagle
#

For that you need to maintain position and orientation

#

z is typically the up-down direction

woeful badge
#

oh

brazen eagle
#

Or in to and out of in graphics

woeful badge
#

I googled xyz and it said y is up/down so I put that in the code

brazen eagle
#

Oh that's the graphics definition then

cobalt kelp
#

I'm doing server and client apps in python (for chatting). They both need threading, do you suggest any library other than _thread?

woeful badge
#

whats the difference between the graphics and th other thing

brazen eagle
woeful badge
#

oh

cobalt kelp
wispy kestrelBOT
#

Gave +1 Rep to @brazen eagle

brazen eagle
#

But that doesn't matter, what's important is that you're consistent

woeful badge
#

oki

#

I may have mixed up axis with velocity somehow

brazen eagle
#

O.o

woeful badge
#

:(

brazen eagle
cobalt kelp
#

I saw the same lib for threading so I might as well try

brazen eagle
#

Wait or not

woeful badge
#

πŸ₯΄

cobalt kelp
#

Threading is similar to multiprocessing, I'll try this one lol

brazen eagle
#

I'd recommend you start in the 2d plane with only x and y

woeful badge
#

technically its only 2d

#

cause I havent added up and down yet

brazen eagle
#

That can be extended easily enough

tawdry crest
#

can stack follow fifo order ? ik it follows Lifo but isthere any way to follow fifo in stack ?

solar hull
#

would it be a stack if it did?

brazen eagle
#

Yeah that would be a different structure

solar hull
#

If you need both operations, then look at deques.

brazen eagle
#

Otherwise you'll be wanting a queue

tawdry crest
#

i didn't understand what he means in last sentence

solar hull
#

They are synonymous.

tawdry crest
#

ohhh sorry my bad

#

FILO

#

i read as FIFO

solar hull
#

IMO you should never talk about FILO, it just gets confusing πŸ™‚

tawdry crest
#

yeah

#

Thnx for the help

glacial sky
#

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?

granite agate
astral coral
#

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

brazen eagle
#

Most are open source

supple shore
astral coral
astral coral
#

I'm not a newbie in programming you know...?

solar hull
onyx merlin
#

If you install random packages, they might have malware

#

It's rare but it happens

brazen eagle
astral coral
solar hull
#

There's no way to check it out quickly.

astral coral
#

We have to review all the code??

#

😱

solar hull
#

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.

supple shore
astral coral
#

No problem πŸ˜‰

solar hull
#

Using a third-party library is always externalising the risk. You're betting on them to be benevolent (and competent enough πŸ™‚ )

supple shore
#

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)

astral coral
#

I tried to restrict but I'm not that confident in pip πŸ˜…

solar hull
#

getting your code to pip isn't really a proof of anything.

astral coral
#

I'm a bit parano I gess

tulip sail
supple shore
#

I thought python developers check the package before it is published

tulip sail
#

kekw Nope -- that would be a hell of a lot of work

#

At best it'll be a glance over

solar hull
#

there are some characteristics that can be caught by static analysis of the code, as well.

brazen eagle
#

Most popular packages are probably alright

magic falcon
#

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

solar hull
#

Getting access to one might be a problem, though. There are open source ones, sure, but their SNR is pretty low.

magic falcon
#

SonarQube is pretty good, from what i remember of the 1 project that used it

#

Pretty wide language coverage, DoD accepted

brazen eagle
#

Sonarqube is getting more and more security rules

#

There's also snyk apparently

#

Might be more for containers though

magic falcon
#

looks like snyk has multiple products

#

big difference between container security scan and source code scans, though

solar hull
#

I think Snyk's free tier is mostly about dependency and container vulnerabilities.

magic falcon
#

they say they have 'open source code scan' at that tier as well

#

but the docs AFAICT don't really describe what that means

solar hull
#

So it seems. No idea what that really stands for.

brazen eagle
#

It's a SAST product from what I've heard

#

Never actually used it

tired sail
#

hey

#

who can help me in java

#

swing

plain gazelle
#

best way to practically learn python and java script?

onyx merlin
#

Do projects

#

Automate processes, make interesting tools, mess about

plain gazelle
#

I don't knw what to begin with

onyx merlin
#

Web directory brute forcer is reasonably easy to start with

#

If you want security

tired sail
#

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

solar hull
#

Oh no, Swing.

glacial sky
#

Guys do you also hate maths but love programming related maths?

onyx merlin
#

No, I enjoy both

glacial sky
#

weird

tired sail
crude chasm
#

What is programming related math? Boolean algebra ?

stone kayak
solar hull
#

Would you like to elaborate? πŸ™‚

stone kayak
#

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

solar hull
#

They seem to spend a big buck in onboarding potential users.

#

hosting events etc.

stone kayak
#

like this

#

if i make an account there are no high risk license issues

#

they're lying to get me to make one

solar hull
#

Eh. That sucks.

#

What about the licenses, do they get those right for an identified component?

stone kayak
#

identified component?

solar hull
#

they find a library, do they identify its licenses correctly?

stone kayak
#

i mean it's not that hard as it's built into github / package managers πŸ˜›

#

so i'd hope so

solar hull
#

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.

solar hull
onyx merlin
ionic hamlet
#

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

onyx merlin
magic falcon
brazen eagle
solar hull
#

I'm thinking of doing Advent of Code with rust. It might motivate me to learn a bit of it.

worldly iris
#

anybody up for a challange

#

who can solve this

true pumice
#

What's this for? @worldly iris

worldly iris
#

codeacademy task

#

i kinda revered engineered it

true pumice
#

And are you asking just to see how people would solve it themslves?

worldly iris
#

i dont think my code will work on all cases

onyx merlin
#

Find some cases it wouldn't work in then

true pumice
#

Also I would change it from arr to list in your function

onyx merlin
#

List is a python type.

true pumice
#

Yes yes yes yes

onyx merlin
#

Bad

worldly iris
#

k

onyx merlin
#

List is the name of the type. Calling the parameter list would be very bad

true pumice
#

Just change it from array

onyx merlin
#

k is a terrible variable name too but that's what they used in the q

true pumice
#

Array is misinformative as the task says list

#

i hate python so much

onyx merlin
#

I have a shorter but infinitely worse version

#

Just that print line at the bottom, line 13

worldly iris
#

print(missing_nos([0, 1, 2, 4, 5, 6, 7, 8], 2))

onyx merlin
#

That's not quite the same but yeah

#

Have some stupidity with sets

true pumice
#
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?

onyx merlin
#

Probably

#

Looks it

true pumice
#

I honestly couldn't tell because it looked too simple to work LMAO

#

@worldly iris drop the link to the challenge pls

onyx merlin
#

Python is just spicy and can do stuff you'd not expect

worldly iris
true pumice
#

Python is easy pfft

#

Thanks

#

Yup, it works with whatever their test cases are

magic falcon
true pumice
#

James pointed that out

#

so I changed it

#

array is bad

#

bad array

#

no arrasy

magic falcon
#

it's bad naming for this problem, for sure

crude chasm
cobalt kelp
#

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?

solar hull
#

Not describing your problem properly?

azure shadow
#

can someone help me with my python RSA H.W plz xD

onyx merlin
#

Again. We don't do homework help here. Ask your teacher.

azure shadow
#

sry james but my teacher isnt helping thats why i came to ask

azure shadow
#

😦

wanton lagoon
#

Ooof

wanton lagoon
azure shadow
tulip sail
wanton lagoon
#

Mmm

#

Not always

tulip sail
#

Shameless self-plug but that might help

tulip sail
azure shadow
wanton lagoon
azure shadow
lilac holly
#

Ok. I've just spent an entire hour hunting for the damn bug when after all it turns out that....

magic falcon
#

Just goes to show, K&R is still an essential reference

lilac holly
#

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

timid dove
sullen venture
#

Hello

lilac holly
#

This maybe silly, but I am having a hard time understanding the purpose of return in Python for functions?

lilac holly
#

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

wispy kestrelBOT
#

Gave +1 Rep to @sage eagle

true pumice
lilac holly
true pumice
#

Ah, I see πŸ˜„

brazen eagle
#

only if the function returns void

empty ridge
#

Anyone doing Advent of Code?

lilac holly
brazen eagle
#

a few

#

Java for example

#

void just means it returns nothing

magic falcon
#

every function returns something, by definition. IIRC, languages that don't require return explicitly, have an implicit return of 0

brazen eagle
#

nothing useful then

sour siren
#

what is a good "black hat" python3 guide ?

lilac holly
sour siren
lilac holly
#

Yeap. The lastest edition is in Python3

sour siren
wispy kestrelBOT
#

Gave +1 Rep to @sage eagle

brazen eagle
lilac holly
brazen eagle
#

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

lilac holly
#

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?

brazen eagle
#

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

steep carbon
#

Is it possible to use winsock2.h library when programing in c on linux?

white hazel
#

It's probably possible, but that sounds like it's platform specific to windows

brazen eagle
#

You can probably copy the header over but I doubt the DLL will work

cold cloak
#

If you’re coding for windows on Linux then you can but you’ll need to install a cross compiler like mingw-w64

steep carbon
#

I installed it and it didn't work

cold cloak
#

It should work but the compiler isn’t called mingw-w64 as that’s just the toolset name

wind root
#

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

magic falcon
white hazel
wind root
#

@magic falcon thanks

wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

empty ridge
#

Sorry wrong one

#

That one

magic falcon
empty ridge
#

Yeah I grabbed the wrong bundle.

#

That one is better for beginner

wind root
#

@empty ridge thanks

wispy kestrelBOT
#

Gave +1 Rep to @empty ridge

wind root
#

Its crazy i can read code but writing and being able to explain it is another story @magic falcon @empty ridge

magic falcon
#

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.

wind root
magic falcon
#

That does not. If I was interviewing a coder who couldn't explain their code, I wouldn't hire them.

wind root
white hazel
#

Did you really?

wind root
#

Absolutely

magic falcon
#

An answer like that in an interview would blacklist you from every panel for that kind of role

#

that I would sit on

magic falcon
#

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.

empty ridge
lilac holly
#

I was looking at the popular programming languages on TIOBE and I see this long term table :

#

Python's is impressive

icy bobcat
#

cheers for SQL in all CAPS

lilac holly
#

lol

dense bridge
#

I need help

#

I need a programmer who knows php

cold cloak
#

Yes, post your problem

brazen eagle
#

Or don't I guess

cold cloak
#

He chose to DM me without permission instead, so he was ignored πŸ€·β€β™‚οΈ

brazen eagle
#

Sigh

#

@dense bridge do I need to warn you about rule 1?

azure peak
#

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?

lilac holly
#

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?

azure peak
lilac holly
# azure peak Bare minimum to understand Logic of python, can not code a program past simple l...

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.