#programming

1 messages ยท Page 27 of 1

true depot
#

The programmers that are here, do you use Linux for your programming? Do you use the same distro and or device (or storage for an OS) for CyberSec and programming? What do you suggest?

pseudo mist
#

I feel Linux is good for it.

vernal vigil
# true depot The programmers that are here, do you use Linux for your programming? Do you use...

I use
Kali -> cybersec
Ubuntu -> running codes.
Tbh you can use any linux distro for running codes, you just need to install the compiler/interpreter on it unless already installed.
Same goes for cybersec, kali is cool cuz it already have many many tools pre installed in it so you dont waste time adding everything from the start

Kali have many compliers/interpreters already in it but i run on ubuntu because I kinda wanna keep my attackbox unborked

surreal bronze
#

most popular IDEs / text editors support all distros and it doesn't make much difference to how you program

true depot
#

So Kali Live with persistence with a great choice ?

surreal bronze
#

I mean, it would be more efficient to use your main OS with it but yes, you can do it it

#

Linux is fine for programming

mortal flint
#

I use windows for most of my dev work

#

Better tooling support for some of the things I need to do

remote echo
#

For now I use WSL2, gives best of both worlds

magic falcon
#

I primarily use linux for programming. Distro doesn't matter, so long as I can set it up with a toolchain that is going to work for that project. To that end, I usually end up with Fedora or Debian. Kali is going to be moderately painful for a project longer than a few months; occaisonally, it just breaks on a rolling update and recovering is possible but painful. I do not recommend using Kali as your daily workhorse.

forest cradle
#

Does anyone know any good websites that can help me learn python ?

true pumice
vernal vigil
#

Sololearn

tepid cargo
urban edge
#

@forest cradle w3schools javatpoint tutorialspoint

restive fossil
#

fixed, partially tho, put a few if statements stopping the loop when meeting my condition, there's one i cant fix, until now, thinking a lot about using threading, but my head hurts when it comes to threading in python, havent gotten around to doing it

stoic badger
lilac holly
#

How can I find the index of other p using this function
letters = ['p', 'q', 'r', 's', 'p', 'u'] print(letters.index('r')) print(letters.index('p')) print(letters.index('p'))
Output

output
`
2
0
0
'

onyx merlin
#

By definition it returns the first, so you'd have to mess with the start and end arguments to make your search ignore the first one.

restive fossil
mortal flint
karmic cape
#

Is there anybody looking to collaborate on improving my own iplogger project (based on node+express)?

#

๐Ÿ˜„

onyx merlin
karmic cape
#

@onyx merlin just hobby!

onyx merlin
#

Ok, but what ethical reason do you have for building an IP logger?

karmic cape
onyx merlin
#

-warn @karmic cape Do not ask for help with unethical projects (IP grabbers) - Rule 9.

wispy kestrelBOT
#

โš  Warned lakshaya#2253

karmic cape
#

I wonder if one can break out of a docker container which was run with the --privileged flag but with docker running in rootless mode

tepid cargo
# lilac holly How can I find the index of other p using this function `letters = ['p', 'q', 'r...

I don't know the context of ur question. But, interviewers/examiners love this kind of dumb questions. they are basically asking you to check the definition of .index run a while loop. Pretty naively u can do like this:

letters = ['p', 'q', 'r', 's', 'p', 'u']
try:
    c = 'p'
    i = letters.index(c)
    while i >= 0:
        print(i)
        i = letters.index(c, i+1)
except:
    pass

and they will ask for time complexity ๐Ÿคฃ . but the time complexity is theta of N, because first it will check till the first occurrence lets say X items, then it will check again N-X items. So it's not checking the items multiple time. instead total N elements are being checked once.

rich wave
#

run into a Go question.

#

So, From what I am understanding. The secondgo fun() runs concurrently with the main functions So after the first For loop(deploy workers) ends, it will just go to the third for loop right? But wouldnt the results be an empty channel? Why would it wait till the worker() to put the open port into results

#

sorry for a noobie questions..

lilac holly
karmic cape
#

maybe

letters = ['p', 'q', 'r', 's', 'p', 'u']
print(letters.index('r'), 0, (len(letters)- 1))
print(letters.index('p'), 0, (len(letters)- 1))
print(letters.index('p'), 1, (len(letters)- 2))
#

This would work?

magic falcon
#

Usually when you are asked to solve a problem like that, it's preferred to do it as general a way as possible, so it can be applied to many different inputs. That looks like it should work for that specific case, how would you generalize it to apply to any list of characters?

onyx merlin
lilac holly
tulip ibex
onyx merlin
#

tl;dr the last line just means "start looking again from where you found the first p, but the next item along"

lilac holly
onyx merlin
#

Yeah, I know how it works

onyx merlin
lilac holly
#

My bad

lilac holly
wispy kestrelBOT
#

Gave +1 Rep to @onyx merlin

tulip ibex
#

oooooooooooh got it thanks a lot @lilac holly and @onyx merlin !

wispy kestrelBOT
#

Gave +1 Rep to @candid glade

lilac holly
#

np

remote echo
#

Which platform you guys will suggest for practicing DSA, like binarysearch.com or leetcode or something else. There are many available...

vernal vigil
#

Geeksforgeeks maybe?

solar hull
#

oh, that was already answered hours ago ๐Ÿ˜„

wispy kestrelBOT
#

Gave +1 Rep to @solar hull

onyx merlin
#

Extra spaces

rich wave
#

Iโ€™m following along black hat go

rich wave
wispy kestrelBOT
#

Gave +1 Rep to @onyx merlin

brazen eagle
lilac holly
brazen eagle
#

ie it exists

north oasis
#

Mhmm

lilac holly
#

Then searches forward from there

brazen eagle
#

yes I know ๐Ÿ™‚

lilac holly
mortal flint
#

depends on the language, but oftentimes, a nonexistent index will return a -1. Passing that in as a value to another function could cause a problem. So Hydragyrum has a good point.

ionic oar
#

Hmm
I see

lilac holly
#

hello?

gusty cliff
#

hi

slate bolt
#

Hi

buoyant spear
#

I have a Dll Injection tool I made in C# following pinvoke for the WINAPI and I a small Dll I made in C that should just open a MessageBox when DllMain is called

#include <windows.h>

__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved) {
    MessageBox(NULL, "Hello, World!", "DllSays:", MB_OK);
    
    return TRUE;
}

the C# code is on https://github.com/RisuSofos/InjectionTool/tree/console and I am getting no errors, it just doesn't work (worst kinda error)

buoyant spear
#

I solved my issue, it was simple. I wasn't using LoadLibrary like i thought

lilac holly
#

ERROR:
encoded = jwt.encode(payload, key, algorithm="RS256",headers = {"kid" : "http://<IP>/keypair.pem"})
AttributeError: module 'jwt' has no attribute 'encode'

CODE:

import jwt
import json

payload = {
"username": "neo",
"email": "test@test.com",
"admin_cap": 1
}

key = open("./keypair.pem","r").read()

string = json.dumps(payload)

encoded = jwt.encode(payload, key, algorithm="RS256",headers = {"kid" : "http://<IP>/keypair.pem"})

print("token",encoded)

#

I tried searching on chrome and it said uninstall module jwt and install pyjwt

true pumice
#

Does it work without key?

#

When reading from a file, usually the data comes in weirdly, you might need to specify what data you're reading in.

#

And what jtw library are you using?

lilac holly
lilac holly
#

like in a efficient manner...should i take the content of a file as a variable?? instead of reading the file contents

true pumice
#

A file is usually formatted as a list in python, so reading it like that anyway will have your text from the file formatted weirdly

#

But, does the jwt.encode error happen all the time? Or only when trying this?

lilac holly
#

all the time

true pumice
#

I mean, on every program?

#

Run this:

import jwt
key = "secret"
encoded = jwt.encode({"some": "payload"}, key, algorithm="HS256")
print(encoded)

and tell me if it errors

tulip ibex
#

error on line 63

true pumice
#

Yes it errors?

lilac holly
#

yes it errors

#

the same

#

what did you pip install ?

true pumice
#

Version of Python are you using?

lilac holly
#

pyjwt

#

and not jwt ?

lilac holly
true pumice
#

There's something wrong with your installation

#

After installing it, did you restart your IDE?

lilac holly
#

ok ๐Ÿ˜ฆ

true pumice
#

Are you using pip3 or pip2?

#

Or just pip

lilac holly
lilac holly
true pumice
#

Which OS are you using?

lilac holly
#

It worked

#

am stupid earlier i installed the library using pip

true pumice
#

hah

lilac holly
#

sorry

true pumice
#

Not a problem

wintry hound
#

Hi mates, looking for an experienced Golang programmer who has already worked with Gorilla and OIDC/OAuth/JWT and is willing to spend some time explaining Best Practices. DM if that description fits you, thanks ๐Ÿ™‚

dapper salmon
#

Does anyone have any idea for a CRUD web app cyber-security themed/related?

restive fossil
#

yo

#

learning golang

#

someone pls break down this code

#

import "fmt"

func split(sum int) (x, y int) {
    x = sum * 4 / 9
    y = sum - x
    return
}

func main() {
    fmt.Println(split(17))
}
onyx merlin
#

That looks readable to anyone who knows a curly brace language.
Have you tried tracing the code? What about it don't you understand?

restive fossil
onyx merlin
#

It's much better to go in with a specific, narrow question

restive fossil
#

ok

surreal bronze
#

Just a heads up, sometimes reading it out loud to your self can help understand it more better

noble turtle
#

Any advice on getting better at coding

vernal vigil
#

Practice

stoic badger
# noble turtle Any advice on getting better at coding

Like most things, you get better by doing it. Find something to automate and write a script for it. Look at other peopleโ€™s code from the GitHub repos you may or may not use. There are plenty more resources in the pins.

long prairie
#

Hi im new in the server a im asking for help

true pumice
#

Whatโ€™s up?

sly breach
#

Anyone here got a little bit of know-how with flask? I know there is a better way of serving a page based upon the value of a cookie as I've done it elsewhere (but had to make it susceptible to RCE)

@app.route("/myroute")
def myroute():
    cookie1 = "cookie1"
    cookie2 = request.cookies.get('cookie2')

    mypickleCookie2 = pickle.dumps(cookie1)
    mycookie2E = base64.b64encode(cookie2)

    resp = make_response(redirect("/myroute"))
    resp.set_cookie("flag", mycookie2E)

Basically I want the value of cookie2 will determine if /myroute is returned or not

#

just a simple elif here that compares whatever value of cookie2 is within resp?

#

say if cookie2 doesn't equal x then redirect to y route?

#

Something like this? ```python
if cookie is None:
resp = make_response(redirect("/myroute1"))
return "Uh oh! You need to create an account first!"

# cookie = pickle.loads(base64.b64decode(cookie))

else:
    resp = make_response(redirect("/myroute2"))
    return resp
tulip sail
#

Shouldn't even need the make_response @sly breach

#

Just ```python
if not cookie:
return redirect(url_for("blueprint.handler")), 301
else:
return redirect(url_for("blueprint.handler2")), 301

sly breach
#

ooooo

tulip sail
#

Should probably protect the second route as well though

#

I'd be tempted to do it with a decorator and just decorate everything involved. If cookie == whatever, execute route2, else redirect to route1

sly breach
#

^ your blog post inspired me on that one

#

I'll have a play around ty ((:

tulip sail
#

Np ๐Ÿ™‚

sly breach
#

I need to some more reading up on Flask but for now it's a band-aid solution ๐Ÿ˜„

tulip sail
#

Hehe. Flask is beautiful

#

No matter what @thorn finch says about Django ๐Ÿ˜ก

sly breach
#

Better than Django!

#

Is Blueprint a flask library/extension @tulip sail O.o?

tulip sail
#

Built into the Flask framework

#

In that case I'm using it as a substitute though

#

As in, if you're doing it all within one module then just do functionname1 then functionname2

#

The blueprint.functionname only applies if the function is in a separate blueprint

sly breach
#

A Blueprint is a way to organize a group of related views and other code. Rather than registering views and other code directly with an application, they are registered with a blueprint. Then the blueprint is registered with the application when it is available in the factory function.
Makes sense

#

Gnarly! ๐Ÿ˜„

tulip sail
#

So, if you had a blueprint called admin and you wanted to redirect to the admin home page, maybe admin.home

#

Yep! Makes life a lot easier

sly breach
#

Sounds like it ๐Ÿ˜Ž

#

Thanks my man!

tulip sail
#

Np! ๐Ÿ™‚

surreal bronze
#

What exactly are you trying to do?

#

Like, when your PC starts you want it to automatically load and come up?

#

@runic hazel

#

If so, you would have to use the subprocess or os module to run this wsl -d kali-linux kex --wtstart -s in the shell

#
import subprocess
command = [command, goes, here]


subprocess.call( command)
#

I'm not sure if python can interact with WSL, but if you did it my way (which starts the Kex automatically with Kali WSL) it would work

#

No problem, let me know how it goes

surreal bronze
#

Eh it doesn't really matter much about the line count, I was just showing a quick example - but yes, that does the same thing ๐Ÿ™‚

brazen eagle
#

or just set up your shortcut to run kex to begin with

tulip ibex
surreal bronze
tulip ibex
restive fossil
#

in python2 theres win32com.shell.shell.ShellExecuteEx(), trying to do this in python3, theres ShellExecute from win32api, but that executes programs, im looking for executing commands

restive fossil
#

in python3

tulip sail
#

...Why?

brave pulsar
restive fossil
restive fossil
tulip sail
#

Well, at least you're asking for elevation ๐Ÿ˜†

restive fossil
brave pulsar
#

UAC bypass coolguy

restive fossil
#

or i could just do an isadmin and if theyre not admin i print out why are you not running it as admin you little || ๐Ÿญ kekw||

restive fossil
brave pulsar
#

Yeah, if I recall they teach that in PWK

tulip sail
#

They do

restive fossil
agile bough
#

Hey can someone tell me what does this instruction do cmp @lilac holly3 , 0x10(r14)

true pumice
#

Well, cmp compares values iirc?

agile bough
#

yeah but what does 0x10(r14) mean?

true pumice
#

I could take a guess, but I'll leave it to someone who knows ASM much better than I, sorry :c

magic falcon
agile bough
#

I don't know what particular architecture they are using

#

nvm i got it

brazen eagle
#

r14 might be register 14?

surreal bronze
#

Is the CTF active?

spare river
true pumice
spare river
#

It's cool, right?! :D

formal kettle
#

didn't know you could do css in console, dam

lilac holly
#

implementation

#

I tried to create a macOS shortcut to mark useful links as resources and then send that link to my private telegram group.

#

It's very similar to the Scratch programming language.

#

I admit this is not the coolest thing to do with shortcuts. So, I'm open to ideas. What you guys think we can do with this new shortcuts feature?

lilac holly
tawdry crest
dusky ore
dusky ore
# dusky ore https://www.hackerrank.com/challenges/cut-the-sticks/problem
vector<int> cutTheSticks(vector<int> arr) {
    vector<int> rs;
    int itr=arr.size();
    rs.push_back(arr.size());
    for(int i=1;i<itr;i++){
        if(arr.size()==1) break;
        else{
        int mnm = arr[0]; 
        for(int j=0;j<arr.size();j++)
            mnm=std::min(mnm,arr[j]);
        arr.erase(std::remove(arr.begin(), arr.end(), mnm), arr.end());
        //arr.shrink_to_fit();
        rs.push_back(arr.size());
        }
    }
    return rs;
}
#

3/10 test cases are failing if anyone can help me?

#

where im doing wrong

solar hull
brazen eagle
#

Wow that code is a mess

lilac holly
#

3.1 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use input to read a string and float() to convert the string to a number. Do not worry about error checking the user input - assume the user types numbers properly.

hrs = input("Enter Hours:")
h = float(hrs)
rate = input("Enter Rate:")
r = float(rate)
x = 0
if h > 40:
    x = h - 40
    e_pay = x * (r * 1.5)
pay = (h-x)* r
g_pay = pay + e_pay
print(g_pay)

what other ways can it be done(I mean even simplest, if possible)

broken shuttle
#

As programmers when do you decide to use an existing tool and when to create your own?

true pumice
#

Does the tool do what I need it to efficiently? Yes -> keep using it, No -> develop my own

#

While Iโ€™m not a massive infosec developer, if I think I can make a better tool, Iโ€™m more tempted to.

Sometimes if itโ€™s a quick tool I can create in a few minutes, I wonโ€™t bother going onto the internet to look for an existing one

lilac holly
#
hours = float(input("Enter Hours:"))
rate = float(input("Enter Rate:"))
pay = hours * rate
if hours > 40:
    pay = pay + (hours - 40) * rate * 0.5
print(pay)

@lilac holly

#

Honestly I do prefer writing it this way:

maxHours = 40
rateMultiplier = 0.5
hours = float(input("Enter Hours:"))
rate = float(input("Enter Rate:"))
pay = hours * rate
if hours > maxHours:
    pay = pay + (hours - maxHours) * rate * rateMultiplier
print(pay)
#

You get paid normally any amount of hours you work.
If you work more than 40 hours you get paid extra.

Then when you wanna adjust any numbers you do it once at the top

onyx merlin
#

Just the more verbose variable names there makes it a million times more maintainable

#

Doing the constants like that is even better, although I'd swap the constants to all caps because python. Also snake case.

true pumice
#

I define constants with an _ before them, _maxHours

#

It's preference, I don't expect people to read or maintain my code.

#

I also usually format my code using comments to make it clearer, grouping sections.

#
# Constants
_maxHours = 40
_aboveRate = 0.5

This is a minor example, I like making good looking code :p

#

I'm not actually sure why I started prefacing them with an underscore, now that I think of it ๐Ÿค”

onyx merlin
true pumice
#

Nooo, pep8 is horrible!

#

I tried, I really did, it drove me to JavaScript KEKWL

onyx merlin
#

PyLint makes it easier

true pumice
#

Hmm

#

I've used a few automation tools to check my code.

#

I really want to get away from Python although, so I doubt I'd go heavily into coding formatting standards.

cedar iron
#

Use black

true pumice
#

I've used black also

lilac holly
# lilac holly Tysm. ๐Ÿ‘

If you want to learn how to write better code Robert Cecil Martin has online lectures and a book over Clean Code. I recommend it a lot after you learned the basics

stone kayak
#

Generally I am super lazy so reaching the last point is quite hard

brazen eagle
true pumice
#

Hmm, I haven't coded in C++, possibly picked it up from one of my tutors who codes in C then, hah

brazen eagle
#

could be

#

I've seen it in C for local variables, or struct members

true pumice
#

I just think it's a nice subtle hint.
It's not the best practice to learn, especially as in (I think it is) Java, it privatises variables and functions.

In rust, it hints to the IDE that it's private, but doesn't really stop you from using it elsewhere iirc.

mortal flint
#

in java, naming conventions don't really have anything to do with variable visibility or scope- there are explicit keywords to define that

lilac holly
#

I also use _ for private fields though my teacher in college doesn't find it necessary

magic falcon
#

The _ thing is shorthand for 'this should be protected or private' for OOP-like languages that don't properly encapsulate

#

in every 'proper' OOP language I can think of, there are specific language mechanisms for encapsulation; in Python, JS it's not enforced at al

broken shuttle
#

Morning everyone

stone kayak
#

Hi

#

Iiiii

celest hatch
#

num1 = ("enter your number: ")
num2 = ("enter second number: ")
num3 = num1 + num2
print(num3)

#

The caculators

dire vortex
#

will that work in python?

#

you might need to convert it from str data type to int, before the calculation takes place

vernal vigil
#

yeah they need to, initially num1 and num2 would be string types.

tulip ibex
true pumice
#

Please change the variable names, numOne - camel case - is a good variable naming format

surreal bronze
celest hatch
#

Thank you so much brother

#

I still learning

surreal bronze
#

Np, keep it up and you'll see improvements in no time

celest hatch
#

I see i see

#

But if don't fill in an integer then the result is the same, just looking at the input

#

Is it only for the type?

#

I finished build the website

brazen eagle
mortal flint
#

Can it run doom?

plain path
#

def delete_starting_evens(lst):
for i in lst:
if i % 2 == 0: del lst[0]
return lst

print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))

why doesnt 10 get deleted as well when I run it? python3

#

I get that its the last item in the list at that point, but still its lst[index 0] so why wouldnt it run

#

anyways I just put in if lst[0] % 2 == 0: del lst[0] and works fine, but idk why does it stop, something with how python iterates over lists?

sharp coral
# plain path def delete_starting_evens(lst): for i in lst: if i % 2 == 0: del lst...

from my understanding its generally not good to delete items while you iterate over them, list comprehension would be much better suited for your function, see this thread for clarification https://stackoverflow.com/questions/1207406/how-to-remove-items-from-a-list-while-iterating

stoic badger
#

This was just from putting print statements before and after the if condition to check what was in i and lst.

plain path
#

it doesnt refresh the indices after every loop instance

stoic badger
plain path
plain path
#

def over_nine_thousand(lst):
i = 1
total = lst[0]
if sum(lst) < 9000: return sum(lst)
else:
while total < 9000:
total += lst[i]
i += 1
return total

print(over_nine_thousand([8000, 900, 120, 5000]))

the function works fine both for arrays that total below and above 9000 when I run it in python, so why is it giving me "list index out of range" error on codecademy

magic falcon
#

There is probably a test condition your input doesn't cover, but that code academy does. How sure are you in examining your edge cases?

plain path
#

not very I guess, lmao, let me try for a bit

#

idk im running it with various inputs and it works fine lol

#

def over_nine_thousand(lst):
sum = 0
for number in lst:
sum += number
if (sum > 9000):
break
return sum

this is the solution provided on codecademy....what is different functionality wise? how does this cover an edge case my solution didnt?

#

the way im looking at it its the same exact shit

#

expect instead of break im using while

#

except*

#

I would even argue my solution is straight up better, since if the total is below 9000 it will just return the sum instantly without even going into a loop, no?

magic falcon
#

It's not though, and I don't think your code covers all the cases you think it does. What if the sum of a list is equal to 9000?

plain path
#

if sum(lst) < 9000: return sum(lst)

#

what am I missing

#

ah

#

okay

#

I see it now

#

thanks

#

@magic falcon thank you

wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

magic falcon
#

And I would argue that your code is also not optimal. Sum could take a long amount of time to process the list and get the result, and you call it multiple times before you even enter your loop.

#

Are you familiar with time complexity analysis?

plain path
#

is sum resource intensive?

magic falcon
#

If you had a really long list, you would be spending orders of magnitude iterating through the list to get the sum

plain path
#

no Im not good enough coder to concern myself with nitty-gritty optimization, just using common sense feels like loops would be the most resource hungry

magic falcon
#

order of magnitude more time* than any other part of the program

#

That's a good intuition. Is there any other way for a sum() function to operate than to somehow iterate over the contents of the list?

plain path
#

I was just gonna say that lmao

#

how can I see the internal code of these built in functions

magic falcon
#

I ask because it's a thing you should spend some time thinking about and exploring. Coding is 100% problem solving, working to understand how things ought to work beneath the API abstractions is a really good idea

plain path
#

totally agree and I appreciate the help

magic falcon
plain path
#

if say, im working offline

magic falcon
#

Print what to console?

plain path
#

the internal code of built-in functions

plain path
magic falcon
#

do you have pydoc installed on that machine?

plain path
#

im about to

magic falcon
#

I don't understand what you are asking

plain path
#

print(max.METHODHERE)
is there something I can put instead of METHODHERE that will output the internal code of the function into console?

#

or sum.METHODHERE

#

or w/e

plain path
magic falcon
#

That's a problem; your code should cause an index error exception in the while loop when the total of the list is exacly 9000.

plain path
#

how come it doesnt? I just cannot seem to figure that out. looking at the code its running the way its written and the output is what I would expect it to be after reading it

#

or rather, how come it should be throwing an error? the 9000 case is covered (by simple running it through the loop, or putting <= instead of < in the first "if" check)

magic falcon
#

Your original code you posted should error out when case is <9000

plain path
#

yeah but it doesnt hence my absolute confusion

#

could it be a python version thing or what

magic falcon
#

If you modified it, the <= 9000 should exit when 9000 gets hit

plain path
#

Create a function named over_nine_thousand() that takes a list of numbers named lst as a parameter.

The function should sum the elements of the list until the sum is greater than 9000. When this happens, the function should return the sum. If the sum of all of the elements is never greater than 9000, the function should return total sum of all the elements. If the list is empty, the function should return 0.

For example, if lst was [8000, 900, 120, 5000], then the function should return 9020.

magic falcon
#

If the list is empty, how does your function return 0? From what i see, you init total = lst[0]. Is there another line?

plain path
#

ah there we go, thats my edge case. now I understand why it was giving me index error. if list is empty there isnt anything at the first 0 index

#

just didnt dawn on me that if list is empty it would be giving index error cuz in my mind for an index error there has to be something to index, but now it makes sense I was being a dummy

spare river
#

OOOOH, CAUGHT OUT, ELLIOT

#

@tulip ibex

tulip ibex
#

HAHAHAHHAA

cedar furnace
tulip ibex
wispy kestrelBOT
#

Gave +1 Rep to @spare river

lilac holly
#

can some1 give good ideas for final year university project ??

lilac holly
lilac holly
lilac holly
#

how can I append all input values in list, cause it just do list = num every time

while True:
    try:
        num = input("Enter number: ")
        if num == "done":break
        print(int(num))
        all_nos = list()
        largest = max(all_nos)
        smallest = min(all_nos)
solar hull
#

by actually appending to the list, not creating a new one on each iteration?

surreal bronze
#

So, you would need to use the .append() function like this:

list.append(num)

#

Where list is the variable name of the list)

solar hull
#

Oh please avoid using identifiers that overwrite keywords or builtins.

#
>>> list()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable```
lilac holly
#

I just realized I was trying to make list inside a while loop without difining it before, so it was obvious it will always be the assigned variable(or I think it does)

#

So whatever I append to it, when loop Iterate it will turn back to the original assigned var

#

๐Ÿ˜

lilac holly
snow stump
#

Hey anyone knows typescript?

surreal bronze
#

Ask your question

snow stump
surreal bronze
#

Code?

snow stump
#

I put a confirm and a array.push

#

But it didnt work

dusty matrix
#

hey so Im developing an app that can have wear OS compatibilty so what can I do so that the watch can send sleep and stress data??

restive fossil
#

any differences between python2 winreg library and python3 winreg library?

opaque spear
#

Imma drop this here ;P

#

Hydra takes 12 minutes. Cerbrutus takes 6

#

Same machine, Same network. Same conditions.

#

Hydra tends to slow itself down the more it runs.

surreal bronze
#

What about shreder?

#

@opaque spear

#

How does it compare?

opaque spear
#

Well shreder is very broken...

#

It opens up the same number of threads as are in your wordlist with a 0.1 second timeout in between

#

And it errors lots, and skips on errros so itโ€™s pure luck if it gets your password

#

@modest frigate can confirm. Weโ€™ve been testing it the last few days.

#

It also crashes my VM 9/10 times because of the number of threads

#

And takes forever to initialise rockyou (when it does work because rock you canโ€™t actually be loaded into shreder in its default state)

#

0day actually replied to that thread talking about cerbrutus

#

@surreal bronze

surreal bronze
#

Ah interesting, does your tool use multi-threading but with a max amount of threads?

#

It looks pretty interesting, I've always had problems with how slow hydra is - could you give a link to the repo?

#

@opaque spear

opaque spear
#

It does. Itโ€™s customisable as to how many threads you use, but 10 is the max reccomended from my tests. However that could be down to my standard internet connection, but could also be down to paramiko/the server side SSH limiting number of concurrent connections.

#

@surreal bronze

#

Itโ€™s in beta at the moment and thereโ€™s a little to go before I make it available (Iโ€™m a bit of a perfectionist)

surreal bronze
#

Hmm, sounds neat

opaque spear
#

Iโ€™ll link it when itโ€™s ready to go

surreal bronze
#

Alrighty! Looking forward to how it goes

#

Are you using GitHub or sormthing else like gitlab?

opaque spear
#

Full intention is to add other network service brute forcing too (SMB and FTP are high on the list)

#

Iโ€™m using GitHub personally but with a private repo

#

It will be really easy to extend too

surreal bronze
#

Would love to help contribute

mortal flint
#

Should also create a room for it and get it added to the tools section ๐Ÿ™‚

modest frigate
#

@surreal bronze

surreal bronze
#

Cheers for the confirmation! I'll definitely check it out when it's available โ™ฅ๏ธ

tulip sail
#

There is absolutely no point in starting one thread per wordlist

#

Your machine is limited to a strict number of logical CPU cores -- anything more than a few extra (useful for context switching) will see no performance benefit

#

It's also really expensive computationally speaking to start threads, so starting one per task is incredibly dim

onyx merlin
#

although in my messing about with threads, the OS is very very good at scheduling them. Allocating 2-4x the number of threads as you have logical cores worked for my workloads. I imagine that's because of down-time while the threads are waiting on resources.

tulip sail
#

Aye, I was seeing optimal performance at about 20 threads on 16 logical cores for my port scanning stuff, but it will depend on how much wait time it has

mortal flint
#

yeah, it's very largely dependent on the task and what the bottleneck is. If a thread is resource starved by something other than cpu (i.e. disk, a producer/consumer, etc.), then having a lot of threads isn't as big of a hit, since most will be idle the majority of the time. But when they are cpu-bound, then you start to pay more of a context switch tax, since more threads are competing for cpu. But yeah, spawning ridiculously high numbers of threads is stupid

magic falcon
#

Multithreading isn't always needed with async io - particularly with sockets

#

a single cpu core can handle a larger number of async requests than you'd think, due to how hardware interrupts bubble up from the NIC when network packets arrive

stone kayak
#

For IO based tasks where you are waiting on some IO, async is better IMO. Especially when you perform the same function with different inputs, itโ€™s great for that. Threading is just easier to do so most people run to it first ๐Ÿ˜

#

Also make sure if you spawn that many async you start executing them right away or you split it up. You can wait a long time while the OS gets ready and prepares to execute all async at same time. Rustscan fixed this issue by executing them at the same time as creating them

#

You may even see a performance improvement from splitting the word list down the middle and using 2 cores (multi-core) and async. Multi-core isnโ€™t affected by the GIL (fact check this, I think only multi threading is) so you will see a speed improvement here

#

Also when you start doing that, you begin to battle the open file limit and to really fix that problem you have to make your program unix only or watch windows users suffer with a slower version ๐Ÿ˜ฆ

#

Mac OS has an open file limit of like 30 itโ€™s ridiculously small so Iโ€™d suggest at least trying to change it for them haha

#

Overall though great job ๐Ÿ™‚

#

((Also less ascii art or introduce at least an accessible mode so / greppAble mode pls))

opaque spear
wispy kestrelBOT
#

Gave +1 Rep to @stone kayak

stone kayak
stone kayak
#

Great work btw

opaque spear
#

thanks

#

39 seconds for 845 tries. hydra takes almost 120 seconds on average on max threads for the same scenario

tulip ibex
#

looks good for my side ๐Ÿ‘

opaque spear
#

of course ๐Ÿ˜„ it will be looking 1337

tulip ibex
#

specially the username and password

opaque spear
#

yesss

#

thast was the plan - just to make them stand out

tulip ibex
#

ill say like make them on a new line

#

instead of the creds found: u p

#

is the SSH protocol specification ccase sensitive?

opaque spear
tulip ibex
#

oh nice

#

good job

opaque spear
#

thanks

tulip ibex
#

trying .,,,,,,Wed

opaque spear
#

lol yup im looking into that also

#

the wed is because i ran date immediately after

#

but want to eliminate that trying line

stone kayak
#

๐Ÿฅบ

tulip ibex
#

@stone kayak its good!

magic falcon
stone kayak
#

Move to rust ๐Ÿคท

#

Or C

brazen eagle
#

concurrent.futures

#

๐Ÿ™‚

#

TIL about XMLUnit...

magic falcon
#

Hydra, that is a subset of multiprocessing

mortal flint
# stone kayak ๐Ÿฅบ

One of my good friends is blind, and has to deal with these issues. Thank you for making such a great blog about it :). I've done a very tiny bit of custom screen-reader code to help him with stuff.

wispy kestrelBOT
#

Gave +1 Rep to @stone kayak

brazen eagle
#

makes things easier to use though

magic falcon
#

definitely. but understanding what a future is, i think may cause more confusion. would not usually recommend it for those brand new to concurrency

plain path
#

Im curious about books on programming. Anybody here use them? How do you find them to be? I find the idea of learning programming by reading a book very abstract, like by the time im done reading the book I forgot 70% of the stuff that was in it because I wasnt applying any of the new information to cement it and build a framework/list of concepts in my brain around the given programming language. Im asking because I do enjoy reading, but I read philosophy, psychology and post-apocalyptic sci-fi almost exclusively

#

is the book meant to be read while infront of a PC, directly applying topics that are taught in the book?

#

smth like this

onyx merlin
#

I have that book to hand at the moment.
It's mostly explanation of concepts followed by examples that you're meant to follow along with.

magic falcon
#

You will get a lot better results by practice along with the reading. The reading will explain a concept, it is up to you to internalize it and find ways to apply it.

#

Most instructional programming books follow that format

onyx merlin
#

I don't think they're ideal for teaching the mindset and logical thinking that you need, but I think they're decent for teaching the language.

plain path
#

thank you for the help lads

prisma tiger
#

When trying to compile dotnet projects. I can create the solution file with dotnet new sln but fails to compile the static binaries with dotnet msbuild.
What Am I doing wrong???

magic falcon
#

I'm not super hip with the dotnet toolchains - if you can post some screenshots of what the command is and what error you are getting, that will help us to help you

plain path
#

the first 100 tries fly-by like nothing and then it lags up real hard, usually

#

and it made sense to me that around 100~ tries would trigger a bruteforce limit

opaque spear
prisma tiger
wispy kestrelBOT
#

Gave +1 Rep to @magic falcon

warped axle
#

Hey i need some of you algorithm pros to help me, i have 2 tuples start = (5, 3) and end = (8, 5) how would i go about looping over every possible value pair until i reach the end value

#

oh and this is my current code written in rust

for i in start_height..end_height+1 {
  for ii in start_width..end_width+1 {
    if iter_count == end_width+1 {
      iter_count = 0;
      continue
    } 
    iter_count += 1;
    println!("({},{})", i, ii);
  }    
}
open flower
#

@warped axle Your current code looks fine to me (btw you can do inclusive ranges with ..=end rather than ..end + 1!

#

You could probably get more idiomatic with some fancy maps or whatever, but really depends on what you're using this for ...

warped axle
#

Yeah the code is good for the most part but for some reason it always misses 6, 3 and 8, 4

#

The rest gets printed out just fine

#

Any idea why?

#

@open flower

open flower
#

more than likely because you're continueing, which I don't see why you need at all?

warped axle
#

Hmmm that might be it

lilac holly
#

I want to count the no. of line in a file
here's my code-

#
file = open('file_handel.txt')
#text stores values inside file, when it loops
text = ""
for i in file:
    text = text + i
nol = 0
for i in text:
    if i == '\n' :
        nol += 1
print(nol + 1)#+1 because last line will not have \n```
#

I just want to see everyone take on this (because I can only think of this one)

open flower
#
with open('file') as f:
    print(len(f.readlines()))
#

?

lilac holly
#

So if you can do this better, please go ahed

open flower
#

Off the top of my head that should be okay

wispy kestrelBOT
#

Gave +1 Rep to @open flower

lilac holly
#

woah, It was really this simple๐Ÿคฏ

open flower
#

๐Ÿ˜„ I've had the same thing happen to me many times, it won't be the last time either ๐Ÿ˜‰

cedar furnace
ebon jackal
#

dunno lol

cedar furnace
#

this is not scikit

#

it is ecapture

#

๐Ÿ‘€

fiery quest
#

did you try this

cedar furnace
#

nope

fiery quest
#

do then

ebon jackal
#

but im guessing its a dependency no?

cedar furnace
#

I don't know how to install microsoft c++ tools.....

cedar furnace
#

I have to import it into my code....

cedar furnace
#

oki

fiery quest
#

@cedar furnace

#

this should help

cedar furnace
#

Yeah, I am already installing it

fiery quest
#

okay cool

cedar furnace
#

thanks for the help tho

fiery quest
#

@cedar furnace did it work

cedar furnace
#

yup

young wedge
#

hey. so, I noticed a very unusual thing when playing around with localstorage. while i was in the localstorage tab under application in web inspect (for chrome), I saw the expected keys and their values. after scrolling through the values, I clicked on the 'toggle device toolbar' button, which revealed a hidden key. How does this work? I'm interested in how this was done, and if it was intentional or not, since I think localStorage.getItem('key) won't be able to access that value. anyone have any ideas how this was done and how this is accessed? it's probably useful only for security, right?

#

it may be useful for a later project

lilac holly
#

why does left side not work but right side does? what is functionally different?

#

explain in ooga booga terms please

#

the math its putting out is wrong

#

somehow

magic falcon
#

Are you familiar with the differences between class and instance variables?

lilac holly
#

im somewhat familiar with javascript objects&methods

magic falcon
#

And, you say the math is coming out wrong? Please post your results

lilac holly
#

Is there a difference between using self.pi and Circle.pi (the class) in the area method? I thought its the same thing, its automatically calling itself as the first argument when called

magic falcon
#

is self instantiated? this could potentially be different if you are running a python script on a machine (baremetal or vm) vs some kind of web platform

lilac holly
#

I dunno, I was under the impression self is sort of conventional place-holder value as it refers to the object calling the method, i.e. refers to itself

lilac holly
# lilac holly

im just really confused as to how do these differ, it seems like my way is the same exact thing just with a few more steps

#

but clearly it aint kekw

#

The more I look at it the more confused I am, honestly.

Why does me doing the conversion to radius (halving) separately and saving that to variables, and then passing those variables as arguments into the method call result in a different result than when doing the division inside the method call?

#

This is python3 just to be clear

lilac holly
#

nvm problem solved, im a goon as usual

#

(typo)

past rapids
#

It sucks you haft to be smart to k now how to hack yโ€™all make it seem so easy ๐Ÿ˜‚

tulip ibex
lilac holly
#

This ones for my SQL homies out there

  1. is JOIN and INNER JOIN the same? Google says yes, but seems a lil sus

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;

lets say I have this, I have two tables Orders and Customers

if im doing SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate why do I use FROM Orders ?? Doesnt it make sense that I would use both? how is Customers.CustomerName being correctly referenced if im not putting Customers in the FROM clause as well?

#

I get how it works just dont understand how come Customers.CustomerName doesnt fuck the query up

past rapids
#

You know how to program donโ€™t you

lilac holly
past rapids
#

Itโ€™s just hard for some people than others if not impossible Especially if you have no support around you in life

lilac holly
#

the concepts are very much the same in each programming paradigm, just syntax, keywords etc. might be different

past rapids
#

So in a way it is not just programming I mean hacking in general

lilac holly
#

I learned javascript okay-ish, started doing tryhackme, eventually hit a wall by not being able to evaluate/fix/edit exploits coded in python by myself, so I went back and started learning python

past rapids
#

Can I ask you this then

#

How long have you been programming

lilac holly
#

I started dabbling in it at the start of this year, but really only started full time studying mid-april of this year. right now I know html, css, javascript, python, bash and powershell, but its a "knowledge a mile wide and a few inches deep" type of deal. But I am living with my parents and have the time to study 8-10 hours a day in peace

#

my main goal is cybersec and as such I dont bother with mastering javascript/python libraries etc., I just wanna understand the code when I see it and edit it if I need to, dont feel like writing software from scratch, I could probably write some easy scripts

past rapids
#

Yea I tried to learn python but idk I feel like you gotta be good at math and stuff like that and to be good a concentration ๐Ÿ˜‚

lilac holly
#

python's concepts have almost nothing to do with math i'd say, you can apply it for stuff that solves complex math problems, algos and such but to understand the concepts you do not need any advanced math at all

past rapids
#

So is like programming like the most important thing when it comes to hacking

lilac holly
#

as far as concentration goes, this is something I struggle with myself as I have a mixed anxiety disorder. I recommend

  1. meditation
  2. there have been medical trials done with supplements, some of them have tangible results in improving cognitive abilities
  3. adderall or other stimulants, although this can be expensive as hell depending on where you live
#

also 3) risk of addiction, though I have never struggled with that at all

past rapids
#

Do you know anything about pen testing

lilac holly
#

im like a step above a beginner I guess. I can root most easy/medium difficulty boxes without looking at hints

past rapids
#

You have any advice for me ๐Ÿ˜‚

onyx merlin
#

You really don't need to program on order to learn to hack.

#

It'll help later on, but it's definitely not a necessity at least to start

clear lodge
# past rapids Itโ€™s just hard for some people than others if not impossible Especially if you ...

Hey Balla, believe in yourself ๐Ÿ™‚ With practice you can learn it! I'm not particularly smart and started learning programming at a later age ( after my brain was already past peak condition ๐Ÿ˜‰ ) and managed to make a career out of it. You just need to do the thing you want to learn. It can all seem overwhelming at first but with practice you will become more confident and it will become easier

past rapids
#

How old where you when you started

clear lodge
#

28

past rapids
#

How old are you now if you donโ€™t mind me asking

lilac holly
#

pentesting websites is a lot easier if you already know js/php, doing manual exploits is easier if you know python/bash etc. thats my line of thought

lilac holly
#

It is one of the bigger issues with school tbh

past rapids
#

Yes I agree I just wish I new people in person that can teach me hands on stuff but itโ€™s impossible to find ethical hackers lol

lilac holly
#

For me, college helps giving structure and networking possibilities. A bachelor is more practical and later on I can specialize in cyber security. However, the hands on learning I truly expect to pickup when I do my internships

lilac holly
mortal flint
wispy tusk
#

How can I open multiple concurrent netcat sessions to a target apart from opening multiple terminal tabs? Automating it using bash and forloop does not works concurrently as It waits for the present process to end before starting the next one

mortal flint
#

maybe with backgrounding the process?

magic falcon
#

behavior can be erratic, doing that. IIRC netcat by defaults waits for stdin, disable with a flag and it ought to work. But that's working off memory, there could be other things that break when you do it

sharp coral
#

well XML namespaces and python are really annoying to deal with, anyone have a favorite library besides the ElementTree XML API?

magic falcon
#

I try convert XML to another, more easily read format when I can. Usually YAML or a dictionary, but that may not be feasible with your use-case

sharp coral
#

hmm thats a good idea, its either that or lopping off the namespace parent at this point -- prepending the {<URI>} in front of the tag im looking for (which is suggested by python docs) seems broken

#

and accessing children by index is even more broken lol, might need to actually massage this data a little bit and remove a lot of junk first since I only need certain children

magic falcon
#

Yeah, definitely convert to YAML or a dict then

rich thistle
#

Hi Guys,

#

I need some help in mitigating a security issue in my code
the issue is in login validation and i can't find a solution for the same

magic falcon
#

Validation is one of the most difficult problems to solve - what language and framework are you using? What's your current validation strategy? Do you have strict limits on what is acceptable, or is the intent to allow any characters?

rich thistle
#

the issue is the attacker hijack the success response and sends it again with the success code

#

The frame work i am using is springboot
but it isn't related with spring boot

#

@magic falcon

magic falcon
lilac holly
#

Hello guys

#

Can anyone please tell me that is that possible to learn programing in mobile and how to learn it?

true pumice
#

Do you mean mobile app development? @lilac holly

lilac holly
true pumice
#

Yes, mobile app development

#

For games, you probably want to learn Unity for the easiest experience. Itโ€™s โ€œeasyโ€ because thereโ€™s plenty of help online.

lilac holly
#

Ahh I heard about unity but...

#

exactly what is it?

true pumice
#

Itโ€™s just a game engine, I would recommend checking it out.

Itโ€™s like Visual Studio, except you can see the objects of your game and move them. Thatโ€™s a really poor explanation but I would really recommend trying it out.

You code in (if I recall correctly) C#

true pumice
#

Type โ€œUnityโ€ into your search browser or go to https://unity.com

Unity

Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.

lilac holly
#

Thanks btw :)

true pumice
#

Not a problem!

mortal flint
#

I actually found unreal much easier to work with than unity, but opinions may differ, and I haven't touched either in a long time

magic falcon
#

I think both are a pain, and tech debt on entry is pretty high. My recommendation is don't try to use unity or unreal as a platform to learn programming. Be a programmer first, and your experience won't be as bad

mortal flint
#

definitely agree with that

placid goblet
#

Anyone knows what is SSCRIPT

warped axle
lilac holly
#

python3

#

is there any difference functionality wise between the code on the left (my solution) and the code on the right (proposed solution)

#

isnt my more effective since im assigning it directly?

remote echo
#

Read the description above

#

They specifically told you that they should be initialized to 0

#

First comes correctness then efficiency.
It's better to have correct inefficient solution than incorrect efficient solution.

#

Not my words kekw

solar hull
solar hull
lilac holly
solar hull
#

For the end result in this use case, no. But your initializer function does not work according to the spec.

lilac holly
#

Init is used for initialisation.
When you initialise an object you want to only define anything that is necessary for functioning. Setting variables to 0 shows that they can't be null.
motor_speed, sensor_range, direction do not change the way DriveBot operates. So they shouldn't be parameters for init @lilac holly

surreal bronze
#

Hiya all, i've been fortunate enough to be invited for the new github co-pilot software. If anybody has anything they want me to test it on or have any questions on it feel free to ask here!

remote echo
#

If we say

# write github-copilot for autocomplition

Or something along those lines, will it give it's source code?

#

Been wondering this for a while ngl

#

@surreal bronze ^ test this too kekw

lilac holly
#

Later on youโ€™ll probably have a function which modifies those 3 variables. Just know that in smaller scale some things may look unoptimised @lilac holly

surreal bronze
remote echo
#

Oof

#

My master plan just got beaten to dust

brazen eagle
#

Copilot is a big nope for me.

surreal bronze
#

How come?

lilac holly
wispy kestrelBOT
#

Gave +1 Rep to @sharp mason

tiny meteor
lilac holly
#

hi

#

xd

surreal bronze
#

uh

#

hi @lilac holly

lilac holly
#

hi jayy

#

emmm I come here because I want to learn programming, coding and hacking games, could someone teach me? xd

onyx merlin
lilac holly
#

a

#

ok xd

#

So what could I do here ._.

brazen eagle
#

Both are a big nope for enterprise code

onyx merlin
brazen eagle
#

So one of the big issues I see with copilot is that it basically uses all of GitHub as a training set. This includes GPLv3 licensed works. Now copilot doesn't go so far as to directly include code from its training set, it will derive new code from said training. Whether this counts as derived code under the GPL has not yet been tested, but as derived code must also be licensed under the GPL, I don't think a lot of enterprises want to test that theory. GPLv3 is already blacklisted nearly everywhere I've worked so far.

#

Also sending code outside the enterprise is usually a big no-no as well because trade secrets and possibly confidentiality

#

How long until an AWS token leaks?

onyx merlin
brazen eagle
#

How long until a new token leaks I mean

onyx merlin
brazen eagle
#

It analyzes submitted code as well, no?

onyx merlin
#

No idea, but all I know is it's only tokens that are already breached that have shown up

stone kayak
brazen eagle
#

I did say derived

stone kayak
#

Fast inverse square root, sometimes referred to as Fast InvSqrt() or by the hexadecimal constant 0x5F3759DF, is an algorithm that estimates 1โ„โˆšx, the reciprocal (or multiplicative inverse) of the square root of a 32-bit floating-point number x in IEEE 754 floating-point format. This operation is used in digital signal processing to normalize a v...

brazen eagle
#

Oh gods it's worse than I though

stone kayak
#

I wouldn't say it can derive the comments though, it's straight up pasting from its training set hehe

brazen eagle
#

Then there are major copyright and licensing issues

brazen eagle
#

Probably

solar hull
#

Can yes. Want to? Suing a huge corporation isn't exactly cheap.

mortal flint
#

There are companies that do nothing BUT sue other companies- patent trolls. It's apparently a profitable business model. Until some company with bigger wallets and more lawyers decides to say screw you to that

magic falcon
#

Or some organization like EFF gets involved

digital dove
#

TPS reportโ„ข๏ธ

brazen eagle
#

This is more copyright than patenting but yeah

brazen flax
#

@tulip sail can I have your help for a minute?

tulip sail
#

With?

brazen flax
#

python prompt toolkit (you're the only one I know who uses it)

#

It's something very simple

#

I am making a chat app which prints messages received onto the screen as soon as they are received using print()

#

Now the problem is: if the other person is typing, it gets ugly

#

Like:

Sender: He
Receiver: Hi
llo
onyx merlin
#

So don't send the data until they press send.

brazen flax
#

Thats one way but what if the receiver types halfway through and waits for an incoming message?

#

I was trying to get something where the receiver's message comes on top like normal chat apps.

#

And I guess that can be done with prompt toolkit.

onyx merlin
brazen flax
#

It's not about sending

#

It's the receiving part

onyx merlin
#

Nah, you're not thinking about it correctly

brazen flax
#

I am just trying to print this received message above the typing spaces

#

That's it

onyx merlin
#

Ok, sounds like you need something a little more advanced than the plain print

brazen flax
#

So that it becomes:

Receiver: Hi
Sender: Hello
brazen flax
#

I guess it can be done with prompt

#

And @tulip sail used it in his exploit codes.

#

Hence I turned to him

tulip sail
#

Yeah, you'd need to print it elsewhere on the screen for that tbh

#

Or have the prompt elsewhere

#

It can't be done with a single i/o interface certainly

brazen flax
#

Yeah. Needs multiple buffers I guess

#

CLI is tough

onyx merlin
#

Use a library

#

Something that'll let you write at pos x,y

brazen flax
#

Any Suggestions ?

onyx merlin
#

Nope

normal sable
brazen eagle
#

This may help?

surreal bronze
#

curses is good

#

(you can use wincurses for windows)

surreal bronze
#

Very new, but it's made by the same creator of rich (very well known python library for text rendering) and looks great! Does not have much docs yet tho.

brazen flax
#

Thanks for the advice @brazen eagle @surreal bronze . You guys are the Best blobheart

proper flume
#

Helo
Does anyone know of a quicker/better way of doing this? - I have a big loop going over a directory of files and for every file I'm looping through a list of strings stored in hash_db.txt and delete the matching string. This is pretty slow in bash when either of hash_db.txt or the target file is large so I'm mainly looking for a way to speed it up.

...BIG LOOP over files ($file)...
while read _hash; do
  sed -e s/$_hash//g -i "$file";
  done < hash_db.txt
sharp coral
#

my super naive implementation would be using head to chop up the file, and background loops like you have above for each file chunk

proper flume
#

ah that could be an interesting way to do it.

magic falcon
#

That's going to be the only real path to optimization without getting data structures and a programming language involved. Doing it in bash that way is always going to be O(n^2), you could probably optimize to linear time doing it in java or python or C++.

proper flume
#

okay I've got it. It's speedy now
Simply backgrounding the sed line was enough. darkchamp

#

It's just a small script for converting my notes so this lazy way is fine

magic falcon
#

That's doing a lot of disk writes - that is always going to be the slowest part of your algorithm

proper flume
#
while read hashy; do
    sed -e s/%20$hashy//g -i "$k" & # <--- Background sed
done < ./hash_db.txt
wait

This reduced the runtime from ~8-10 minutes to about 1m30s, which I'm perfectly happy with
thank you (:

sharp coral
#

oh wow thats pretty clever, I have quite a few scripts I could apply this too ๐Ÿ˜„

dapper radish
#

help

#

help me ple

#

plzzz

#

anyone

#

Write a program to split digits and add 2 if a digit is ODD, add 1 if a digit is even and NONE if a digit is 9

#

@proper flume

#

java

proper flume
#

Lol

dapper radish
#

pls help me out

proper flume
#

We're not here to do your homework

dapper radish
#

I beg u

#

Im just crying man couldnt trying for so many hourrse end getting more errors

proper flume
#

The issue you want to solve here is to decide whether a number is odd or even (or 9) .
If you Google how to do to it you'll find countless solutions

dapper radish
#

i did serach it i couldnt find

#

I litreally have 40 more just finished 13 this one making so mad nd im exchausted

#

if the input is 1234

output should be 3355

proper flume
#

You need to think logically and break down the steps you need in order to achieve that output.
I'd advise starting with writing a small program to slice up the input into digits.
Then write another program that determines odd or even
And so on...

#

The first result on google literally shows a solution for your problem if you google odd or even number java

dapper radish
#

okay

brazen eagle
#

The % operator may be useful. Though & might also work

#

But google it yes

remote echo
#

Bitwise operators are OP

#

Untitled-Diagram521.jpg

#

They messed up the title though

onyx merlin
#

It's upsetting that they use dashes in front of the numbers. They're not negative. Or they could be but then the numbers don't line up.

remote echo
#

I think it's just like ->

onyx merlin
#

It's meant to be. But the point is that it's unclear.

plain path
#

How does import work in python, or other similar OOP langauges for that matter? I understand how it works and what it is, but what im missing is where is the module im importing being pulled from.
I dont need to specify a path or anything, I type import xyz as abc and module xyz gets imported under alias abc. So where is this being pulled from? is there a native directory for python where modules are stored? what about running code on offline / air-gapped machines? You need to have those external packages installed for python to be able to pull them when the code is executed, right?
At first I thought each library is basically a unique-id name tied to the library lookup (similar to how programs can be downloaded with just the name using apt) but that doesnt make no sense because it would require constant connection and makes things unreliable

onyx merlin
#

Check out Pythonpath

wispy kestrelBOT
#

Gave +1 Rep to @onyx merlin

plain path
#

Within a module, the moduleโ€™s name (as a string) is available as the value of the global variable name.

if im understanding this correctly, python will automatically assign the global variable name based on the name of the file? and then that allows for lookup in other portions of the code / other files (?)

magic falcon
#

When the module is being imported, yes.

#

If the module is being executed as the main entry point, then the __name__ variable is assigned __main__, not the name of the file.

plain path
#

thank you juun (dont wanna @ and disturb)

brazen eagle
#

Java's bytecode compiler actually replaces x % 2 == 0 by x & 1 == 0

magic falcon
magic falcon
brazen eagle
#

Source to bytecode I think produced identical results

#

It was a while back

#

Could've been the machine code. C optimizes it with an AND

empty cloud
#

Hi folks!
I'm a student looking to expand my GitHub resume by implementing valuable projects.
I'd like to get some ideas for good projects written in C++ which are valuable/impressive for Security Research/Vulnerability Research (Linux Kernel)/Low-Level Development and Research.

So if you have recommendations, I'd like to know.
Thank you!

mortal flint
#

Check the pins, there's an image there with a bunch of project ideas

glossy isle
#

Some good stuff in there.

brazen wedge
#

hey everyone. Im having an issue getting a python exploit to run. Im getting
ImportError: No module named termcolor
Google hasnt been super helpful

#

People just keep saying install term color lol. Though i know have it installed. Does anyone know how to fix this?

sharp coral
#

you're probably using the wrong version of python

onyx merlin
#

Install termcolor for python2

brazen wedge
onyx merlin
#

Well, you don't install it via your OS package manager.

brazen wedge
#

pip right?

onyx merlin
#

You'd install it with python2 pip.

#

Specifically python2 pip.

#

pip can point to python3 pip, and does in new installs of Kali.

glossy isle
#

Typically python and pip default to the latest version, so you'll pretty much always want to specify. Weird looking syntax errors are basically the same thing, v2 and v3 are very different.

onyx merlin
#

python traditionally was python2, but this really changed when python2 was deprecated.

brazen wedge
#

ok so how would i go about running both?

glossy isle
#

For me I just run python2 and python3 for their respective version

brazen wedge
#

no how would i get termcolor installed in python2 so it will run in this script.

#

i get how to run python2 and python3 but how do i get pip2 to install termcolor for python2

onyx merlin
#

You'll probably need to install pip for python2

brazen wedge
#

where though. the kali repositories dont seem to house python2 pip

glossy isle
#

If you can run pip2 or pip2.7 it's already there and you just have to do the pip2 install termcolor or pip2.7 I'm not 100% there, they're the same thing on my machine.

brazen wedge
#

neither are on this machine pip2 and pip2.7 say command not found.

#

sudo apt-get install python-pip says theres no installation candidate and its been replaced by python3-pip

onyx merlin
brazen wedge
onyx merlin
#

I just found a couple guides on it, worth searching how.

brazen wedge
#

if i cant get it through the package manager. Am i just going to pythons website and downloading an old package and installing?

#

dude ive been searching

glossy isle
wispy kestrelBOT
#

Gave +1 Rep to @glossy isle

glossy isle
#

Now my Discord is whining at me to update so I'll be back in a bit, it's decided to get hot in here again so small break for me haha. Hopefully that page works out for you otherwise there is a stackoverflow answer if you use the right search terms ๐Ÿ˜‰

brazen wedge
# onyx merlin I just found a couple guides on it, worth searching how.

Idk if you think you're helping or not. But you aren't. This isn't our first interaction. You always come back with these cryptic non-answers to legitimate questions. So Im going to let you know this now, so we don't have to do this again. If Im here asking for help with something, I have been searching for the answer at least an hour beforehand. I've read the same non answers youve given on 30 other sites before coming here. So do me a favor and just let someone else answer next time. Cool?

onyx merlin
#

No need to be rude about it. Tell us what you've tried.

brazen wedge
onyx merlin
#

-mute @brazen wedge 10m Go chill. Don't be rude. Accusing people of copying and pasting answers with no evidence when they haven't is quite rude, and generally you need to change the attitude you're taking towards the volunteers here.

wispy kestrelBOT
#

๐Ÿ”‡ Muted RazElGoon#4023 for 10 minutes

remote echo
#

๐Ÿ‘€

vernal vigil
brazen wedge
wispy kestrelBOT
#

Gave +1 Rep to @vernal vigil

vernal vigil
#

ah they were someone else, glad you got your stuff working o/

#

oop, my grammer go brrr today

brazen wedge
# vernal vigil ah they were someone else, glad you got your stuff working o/

Well thanks anyway! I'm not totally sure what the exact issue was in the end but I had to reinstall python2 and wget pip 2 onto my machine with the correct link. It's changed since most of the instructions were written. Once that was done I ran this python2 configuration/setup.py then tried the exploit again. It ran perfectly.

wispy kestrelBOT
#

Gave +1 Rep to @vernal vigil

brazen wedge
#

It's pretty ridiculous that there's all this incompatibility within python. Hopefully that phases out one of these days.

lilac holly
#
storage = []
i = 0
while len(storage) <= 8:
    i = i * 2
    storage=storage.append(i)```
#

I can't get why am i getting this error while len(storage) <= 8: TypeError: object of type 'NoneType' has no len()

#

Isin't type(storage) is 'list' then why its showing 'NoneType'

solar hull
remote echo
#

Yes

#

As it returns none, storage get assigned to None

#

So it breaks after first iteration

#
storage = []
i = 0
while len(storage) <= 8:
    i = i * 2
    storage.append(i)
#

Btw, just in case it's not intended,ur appending 0 everytime, as 0 * anything gonna be 0

lilac holly
#

ah, I get i = o so 0*2 = 0

#

that's y none

remote echo
#

No

#

That's not reason for none

#

It is None cuz u assigned storage = storage.append(i)

#

.append returned none

#

So storage became none

lilac holly
#

hmm, but should'nt it append i which is 0

#

is it appending nothing?

remote echo
#

It append 0 to list

#

But return None

#

@lilac holly ^ check this

lilac holly
#

alright, thanks

lilac holly
#

it should just be python while len(storage) < bitno: i = i * 2 storage.append(i) print(storage)

proper void
#

this is a part of an assembly program where r12 contains the number of digits in the string(eg. "123" ,r12=3) and the string is in stack,and we have to output the string,can somebody explain it
print:
;;;; calculate number length
mov rax, 1
mul r12
mov r12, 8
mul r12
mov rdx, rax

     ;;;; print sum
     mov rax, SYS_WRITE
     mov rdi, STD_IN
     mov rsi, rsp
     ;; call sys_write
     syscall

jmp exit
proper void
small fog
#

name = input("name: ")
if name == "shane":
print("hi " + name)
else:
print("go away" + name)

small fog
true pumice
#

I think you mean authentication :)

proper void
#

how many bytes are normally allocated to the command line arguments in linux?

glossy isle
#

Ignoring null byte and memory padding

hallow nest
#

Guy i need help with some code im creating a ransom but every time a click on build solution and a run the ransom fucking windows 10 virus pupbup

#

Any way that i can bypass

onyx merlin
wispy kestrelBOT
#

๐Ÿ”จ Banned luckyrd12345#6838 indefinitely

brazen eagle
#

did someone forget to put ethical on the server description, or did they just not read?

glossy isle
#

Try (ethical) Hack Me ๐Ÿ˜‰

deft root
#

i'm using kali linux on macOS Big Sur with virtualbox and its really slow with scrolling and opening apps... any suggestions on how to make it less laggy?

digital dove
deft root
digital dove
deft root
digital dove
#

That's all I have. ๐Ÿฅณ

brazen eagle
#

is it an M1 mac?

digital dove
#

VirtualBox does not run on M1 at all.

brazen eagle
#

ah kthen

digital dove
#

VMware hopefully soonโ„ข๏ธ

onyx merlin
#

This doesn't sound programming related though

lilac holly
lilac holly
#

I think it isn't a scam link because it has"discord.com"

solar hull
#

Definitely a scam. @fallen monolith ?

fallen monolith
#

i put in a single quote and it said success kekw

solar hull
#

(also, having "discord.com" in the middle of a domain name is not a proof of anything...)

fallen monolith
#

well

solar hull
#

yep.

fallen monolith
#

but yeah

#

still sus

proper void
#

what exactly is a return address in a stack,and why is it pushed onto the stack frame when a function is called?

true pumice
#

Iโ€™m no professional, but it seems a return address is just something that tells the function to resume executing from after the function had completed.

#

I cannot answer the second question for the life of me but I hope that helps even a little

warped axle
#

Hey does pwntools have any function to automatically find the address of GOT?

#

I know how to find it in gdb but i want to automate that process

deft root
#

can anyone help me with install the parallels tools for kali linux? i'm on mac

true pumice
#

You probably wonโ€™t find all the tools

deft root
true pumice
#

Not every tool was recreated to work on macOS

deft root
#

yeah that's ok

remote echo
# proper void what exactly is a return address in a stack,and why is it pushed onto the stack ...

Function gets converted to a stack frame u can say so we execute the code within that stack frame, we need a return address so that we know what to execute after that function.
Suppose you call a function, our instruction pointer goes to the stack frame where function is, executes it step by step, but now, it doesn't know where he came from in order to see what's after the function in our program. That is why we need a return address. After all steps of function finish executions, it just jumps back to address where it came from to execute rest of program.

deft root
#

is vmware fusion the mac version of vmware workstation?

deft root
wispy kestrelBOT
#

Gave +1 Rep to @thin pond

deft root
#

how do u get reps?

thin pond
wispy kestrelBOT
#

Gave +1 Rep to @deft root

clear needle
clear needle
deft root
proper void
wispy kestrelBOT
#

Gave +1 Rep to @remote echo

true pumice
wispy kestrelBOT
#

Gave +1 Rep to @clear needle

cobalt kelp
#

how can this be 96, what happens behind?

true pumice
wispy kestrelBOT
#

Gave +1 Rep to @true pumice

glad glen
#

Question about a problem from Cracking the Coding Interview
Chapter 4, Trees and Graphs, Problem 4.1
Route Between Nodes: Given a directed graph, design an algorithm to find out whether there is a route between two nodes.
In the solution they mention that it is sufficient to either DFS or BFS from either node until we can find the other node or end
However, I dont get how that is sufficient. Since it is a directed graph, shouldnt we be using BFS or DFS from both sides and return the result of the OR of doing the search?
i.e. return BFS(node1 as source) || BFS(node2 as source)?

magic falcon
#

You are trying to think of the BFS or DFS as starting from multiples places. The standard algorithms aren't concurrent, so you are overthinking what the question is asking of you.

#

I think your time is going to be best spent reviewing the algorithm and doing some tracing to understand it more in depth. Do you have an algorithms text book?

glad glen
#

For example if the graph is

 -----    -----    -----
 | 1 | -> | 2 | -> | 3 |
 -----    -----    -----

and we select 3 as the beginning node, we will not find 1.

magic falcon
#

Right; and DFS is sufficient to determine if 1 is reachable from 3.

#

The question is limited to determine if a route exists, not to always reach the other node

#

The question is poorly worded; I think there is an implicit assumption being made by the writer that start and end nodes are defined before running the algorithm. I don't have the book, so that's my take. Finding bad questions is a large part of the coding interview as well.

glad glen
onyx merlin
#

So there's no route between 3 and 1 in that example as the edges are directed

#

You're not discovering nodes, you're seeing if there's a route

lilac holly
#
ords = [81, 64, 75, 66, 70, 93, 73, 72, 1, 92, 109, 2, 84, 109, 66, 75, 70, 90, 2, 92, 79]

print("Here is your flag:")
print("".join(chr(o ^ 0x32) for o in ords))```
#

Can someone explain what o ^ 0x32 is doing here?

warped axle
#

Xoring every element of ords with 0x32

#

And then converting that to ascii

lilac holly
onyx merlin
#

Write the numbers in binary

warped axle
#

Imma leave that to james

onyx merlin
#

Like
0001 0000 (32)
0010 0000 (64)
Then xor column by column

lilac holly
#

then it will chr xored values?

warped axle
#

Yes that is converting the xored values to ascii characters

onyx merlin
#

Convert them back to characters, yep

lilac holly
#

ok, thanks, btw if I want to learn more about this, under which topic will it come?

magic falcon
#

Binary operators

onyx merlin
#

XOR could be considered crypto in a way?

warped axle
#

Yeee

onyx merlin
#

What's that site which teaches crypto from fundamentals with challenges?

warped axle
#

Cryptohacker?

#

Ohh its cryptohack

lilac holly
#

y it turned red

onyx merlin
#

I can't find the one I'm thinking of

magic falcon
#

Implementation is largely language dependent, but most programming languages have a way to implement the concepts.

onyx merlin
tepid cargo
#

anybody manged to properly integrate yarn2 with webstorm or jetbrain category ide?

verbal swift
#

Give examples of ten (10) software systems that clearly depicts the relationships between server, client and middleware.

dapper radish
#
<html>
<head>
    <p>build the web page,</p>
<style> 
h4 {text-align: center;}
table, th, td {
  border: 1px solid black;
}
</style>
</head>
<body>
    <body>
        
        <h4>Specification Table with Hourse and Marks</h4>
        <table style="width:100%">
        <tr>
            <th>Unit No.</th>
            <th>Unit Title</th>
            <th>Teaching Hourse</th>
            <th colspan='3'>Distribution of Theory Marks
          <table>        
                     <td>R level</td>
                     <td>U level</td>
                     <td>A level</td>
                     <td>Total Marks</td>
     </th>   </table>    
        </tr>
        <tr>
          <td>I</td>
          <td>Introduction to Internet Technology</td>
          <td>2</td><td>4</td><td>4</td><td>0</td><td>8</td></tr>
          <tr>
          <td>II</td>
          <td>Basics of HTML & CSS </td>
          <td>6</td><td>0</td><td>2</td><td>6</td><td>8</td>
          </tr>
       <tr>   <td>III</td>
              <td>
ACtive Server Pages 3.0</td>
              <td>6</td><td>4</td><td>8</td><td>0</td><td>12</td>
          </tr>
          </tr>
             <td>IV</tv>
             <td>Server Side Coding with VBScript and XML</td>
             <td>8</td><td>2</td><td>4</td><td>8</td><td>14</td>
             </tr>
             <tr> 
               <td>V</td>
               <td>ASP Objects & Components</td>
               <td>10</td><td>4</td><td>4</td><td>6</td><td>14</td>
               </tr>
               <td><th>Total</th>
               <th>42</th> <th>18</th> <th>26 </th> <th>26</th> <th>70</th>                

        
        </table>
    </body>
</html>```
dapper radish
#

??

tiny meteor
#

I mean keep ur code inside like this

Ur code goes here 
#

This is possible if u use three ` at beginning and ending

dapper radish
tulip ibex
dapper radish
#

link?

tulip ibex
#

or is that a test? or some course

dapper radish
#

this my code in VS Code

tulip ibex
dapper radish
tulip ibex
#

oh so this is ur challenge

dapper radish
tulip ibex
#

i think u can use &nbsp or smthin in html to give a space for those numbers?

#

also is that a school project or somewhere from the net? if its not a school proj can u please sent the link/

dapper radish
#

its school project

tulip ibex
#

ah okay

#

they must have told u how to make spaces in between

dapper radish
#

idk how to make ranks in table

onyx merlin
tulip ibex
#

if not css wont

<center>....</center>
``` work
brazen eagle
#

CSS is the current standard

dapper radish
#

thank u

brazen eagle
#

I'd look up colspan as well instead of having tables within tables

#

the MDN is an excellent html/javascript/css reference in general

dapper radish
#

ty

magic falcon
#

Always separate content from formatting. Your life will be much happier.

formal kettle
#

User agent will take over if you donโ€™t tell it what to do, you can do instyle or preferably a separate css file. And a reset css file is always a good idea as well.

brazen eagle
#

What juun said

stoic geyser
#

Hi guys, I am currently trying to find an working regex for my problem. My text looks as follows:

# Supports `YAML` files
 2 syntax "YAML" "\.ya?ml$"
 3 header "^(---|===)" "%YAML"
 4
 5 ## Keys
 6 color magenta "^\s*[\$A-Za-z0-9_-]+\:"
 7 color brightmagenta "^\s*@[\$A-Za-z0-9_-]+\:"
 8
 9 ## Values
10 color white ":\s.+$"
11 ## Booleans
12 icolor brightcyan " (y|yes|n|no|true|false|on|off)$"
13 ## Numbers
14 color brightred " [[:digit:]]+(\.[[:digit:]]+)?"
15 ## Arrays
16 color red "\[" "\]" ":\s+[|>]" "^\s*- "
17 ## Reserved
18 color green "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
19
20 ## Comments
21 color brightwhite "#.*$"
22
23 ## Errors
24 color ,red ":\w.+$"
25 color ,red ":'.+$"
26 color ,red ":".+$"
27 color ,red "\s+$"
28
29 ## Non closed quote
30 color ,red "['\"][^['\"]]*$"
31
32 ## Closed quotes
33 color yellow "['\"].*['\"]"
34
35 ## Equal sign
36 color brightgreen ":( |$)"

What I'm trying to achieve is, to remove all leading numbers. Actually I'm good, except that case with the following chars '9_', which will be also matched with the following regex:

/[0-9]\w+|\s[0-9]\W/g

So as you can imagine, my question is, how should my regex look like, to get the desired matching. I trying to figure this out now, for a while but I'm not finding any solution. So hopefully there's someone out there, which has a much better regex knowledge than me. Thanks!

~ algorithm

brazen eagle
#

try using a ^ at the start

magic falcon
#

Pattern can have a specific format dependency based the engine and tool you are using as well. Posix regex is slightly different than perl, and so on.

onyx merlin
solar hull
#

Well, the question contained "trying to find an working regex for my problem." Isn't that countered with "Now you have two problems" ๐Ÿ™‚

brazen eagle
#

Usually yes

#

Sometimes a few more

solar palm
#

so I wanted to parse my html with regex... <2 years later>...