#programming

1 messages Β· Page 20 of 1

brazen eagle
#

Sneaky

#

Good way to divide by 2

#

Shift right, and 1

#

The add four times is doing a shift left by 2

#

It's not wrong

#

And this is why premature optimization is bad and you shouldn't do it

#

The compiler is smarter than you

#

I should look at how Java does this in bytecode

#

So I can yell at people to stop trying to optimize code and make the thing readable

wheat forge
#

lol

#

yeah agreed

#

people shouldn't try optimising something unless they know for sure it'll be slow, and have tested it

#

I was doing a thing not so long ago where I was trying to optimise some C, spent ages on this one section, then realised it was barely ever called and by focusing on another bit it knocked a lot of time off

brazen eagle
#

I mean if you have a 50 kHz cpu and 16K memory then by all means optimize

wheat forge
#

not saying you shouldn't optimise code, but you shouldn't blindly 'optimise' code that may or may not even be the problem

brazen eagle
#

Even then it'll probably end up worse than before with the added bonus of being unreadable now

#

People often try to be too clever. I would know I was one of those

wheat forge
#

yeah

lilac holly
#

To write a program that can delete all my files in my downloads linux files should I write this in python? And where do i begin

wheat forge
#

why would you do that when you can use rm?

brazen eagle
#

rm -rf /home/name/Downloads/*

wheat forge
#

^

brazen eagle
#

In python: system('rm -rf /home/name/Downloads/*')

#

Or something

lilac holly
#

I want to write my own programs

stone kayak
#

not in python, pretty sure I saw someone benchmark it but tbh the python interpreter dues like no optimisation so what can you expect

#

no I did not :-(

onyx merlin
#

I think we did like ((x<<1)+2)>>1

brazen eagle
#

I mean in JavaScript you'd do npm install isOdd

onyx merlin
brazen eagle
#

Eww

#

I mean it work but that's just dumb

onyx merlin
#

That was... the whole point

brazen eagle
#

Coding test?

onyx merlin
#

No

#

worst way to increment a number

stone kayak
#

I have a great write-up on a problem involving bitwise operators on my binarysearch account

brazen eagle
#

Oh I see

#

You can try to do it by overflowing the buffer...

#

Or underflowing those are fun too

brazen flax
#

I am trying to make a DIY Wifi Pineapple using OpenWRT and in a captive portal I'm trying to log the captured creds into a file

#

But am stuck with PHP

#

Any idea how to log them ?

tribal smelt
#

but there's a php script there @brazen flax

brazen flax
#

I tried the one given which saves the credentials, but it doesn't seem to work

tribal smelt
#

did you have stored.txt in the directory?

brazen flax
#

Yes. I have tried :
-> creating the file
-> not creating the file
-> change perms
-> other fixes

#

None helped

tribal smelt
#

you can dm me if you'd like.

#

@brazen flax Does the modified date / time of the file change when the script is ran?

#

And does the file actually get fwrite($file, "Username: " . $username . "\n" . "Password: " . $password . "\n\n"); in it?

wheat forge
stone kayak
onyx merlin
#

It wouldn't let me look so ok

stone kayak
onyx merlin
#

bee you're mad

stone kayak
wheat forge
#

it's a pretty obvious solution really

#

from the definition of a power of two

#

if you want to go full bitwise n-1 is ~-n

#

is there any way to submit a solution to that site without having to sign up

tribal smelt
#

@brazen flax I'd check to see if anything is even being put in the file as well

lilac holly
#

im starting to learn javascript, i might learn more tonight.

sour apex
#

i'm trying to write a loop to go through a website rabbit hole in bash, how do i declare the response returned as the next request and do it recursively?

#

should i switch to python?

brazen eagle
#

might not be a bad idea

#

are they using redirects, or links?

sour apex
#

no redirects. the get request for the next request is in the response of the current request

brazen eagle
#

in plaintext?

sour apex
#

yes

brazen eagle
#

might as well use netcat then...

lilac holly
#

im really bad to hack but can this server help me get bedder

mystic nimbus
#

@brazen eagle in your great escape python script, why not just put the ip in the request line instead of defining it as a variable

true pumice
#

Easier to change for people viewing the script.

brazen eagle
#

I could

#

it's a quick and dirty script

mystic nimbus
#

I just usually never had separated like that and was wondering

true pumice
#

I always define it separately, especially if I am going to use the host more than once, allows me to just reference the variable as opposed to getting the user to change a bunch of values.

mystic nimbus
#

I have had a few scripts in the past where I could have done something similar, learn something new everyday on THM

brazen eagle
#

I could have added it as a cli param

#

but since I was reusing the script a few times, I didn't feel like retyping the ip each time

#

I set the target ip as an env var when doing THM boxes as well, makes writeups a bit easier

lilac holly
#

Anyone have any recommendations on where to learn c++ practically?

lilac holly
#

how do i access a link using an proxy

#

like when i do requests.get(url), i dont want to reveal my ip

#

i wanna access using a proxy

onyx merlin
#

Why don't you want to reveal your IP? @lilac holly

lilac holly
#

am making my own prototype vpn

#

if that makes sense lel

onyx merlin
#

No it doesn't

#

Don't roll your own crypto.

lilac holly
#

someone people told me python is not the best for this tho

lilac holly
#

i heard free vpns sell ur data, paid ones are paid

onyx merlin
#

You don't need a VPN usually.

surreal bronze
#

The real question is

#

Why do you want to use a VPN

brazen eagle
#

As for proxy settings, they should be documented

lilac holly
#

ok

lilac holly
#

socket.gaierror: [Errno 8] nodename nor servname provided, or not known

#

why

clever loom
#

hey guys im new to programming and i was wondering if it was something i could do and would it be really hard to start hacking to someone new like me

hexed flax
#

just like everything

clever loom
#

cause it looks very hard

onyx merlin
#

Programming and hacking are somewhat related, but not the same.

brazen eagle
clever loom
#

ok

#

what do u guys create

surreal bronze
#

What do you want to create?

clever loom
#

like what is something u guys create?

sharp coral
#

if you do something repetitively on the computer often then it's worth trying to automate it through a program

#

I've made a wrapper for nmap because I dont feel like finding ports and having to re-scan in stages and also keep typing in those commands all the time so I made a script to feed it an IP and let it rip, thats a really basic example but the best way to learn is by picking a project and kinda figuring it out as you go along

#

APIs can give you a lot of fun projects too if you get some dev creds

clever loom
#

ok

brazen eagle
#

but I should go a bit further and automate the scripty bits

surreal bronze
brazen eagle
#

sure

true pumice
#

Imo, unless it can be improved upon its a waste of time and energy.

#

Also depends on what task you’re trying to complete.

dapper reef
#

Hello guys, I need some advice/source if possible.
Im having a really harsh relationship with algorithms.
What is "the best" way to learn algorithms. I tried LeetCode, CodeWars, etc.. but not much improvement.
How you guys learned algorithms, how to have a deeper understanding of it?

magic falcon
#

Are you talking about understanding algorithm complexity?

brazen flax
#

Any Archlab users here ?

surreal bronze
true pumice
#

Not always, if you know another useful tool that could be created, it would be much better to put all that energy into the other tool.

tight lark
stone kayak
#

I updated my system design cheatsheet docs. Some madlad from FAANG went ham and corrected me on a lot of it so now it's accurate πŸ˜„

#

realised i can just post the link lmao

stone kayak
#
>>> 12 // 5
2
>>> --0-- 12 // 5
3
>>>

My fave Python operator, the spaceship

#

Turn floor division into ceiling division by putting it into a spaceship

onyx merlin
#

Care to explain?

stone kayak
#

It's not actually an operator it's just abuse of mathematics:

--0-- 12 // 5
(-(-0)) - ((-12) // 5)
-(-12 // 5)

TL;DR it works in negatives (turns the world upside down) so the "floor" actually becomes the ceiling. We use abstraction because --0-- looks way funkier and funnier

onyx merlin
#

I swear "it's just abuse of mathematics" is your MO at this point

wheat forge
#

I prefer the 'goes to' operator

onyx merlin
#

Slides to.

solar wave
#

Put under MongoDB "pain in the ass to use with Django"

#

Django needs every model to correspond to a database row -> Mongo supports embedded documents that don't need to contain an ID -> the models have to be set to abstract to get around it -> djongo doesn't let you serialize abstract models and the documentation is utter trash

sour apex
#

is there a python module that reads the text content of an image

lilac holly
#

pytesseract - a wrapper for Tesseract OCR

novel cobalt
sour apex
#

ok thank you

lilac holly
#

how do i add items to a existing dictionary
in python?

novel cobalt
lilac holly
#

no

#

i have a list

#

directionaryu

#

i want to add items to it

stone kayak
#
x = {}
x["item1"] = "value"
#

like that

errant vortex
#

Who can recommend me a python resource ?

onyx merlin
#

For what?

stone kayak
wheat forge
lilac holly
#

Is it possible to automate this process ?

#

xxd -r data.txt > data_xxd_reverse
zcat data_xxd_reverse > data_zcat
bzip2 -d data_zcat
zcat data_zcat.out > data_zcat _2
tar xvf data_zcat_2
tar xvf data5.bin
bzip2 -d data6.bin
tar xvf data6.bin.out
zcat data8.bin > data8_zcat
cat data8_zcat

stone kayak
# wheat forge Huh?

lmao mathjax rendering messed it up, it's supposed to be the set of 1 is not in the set of 1,2,3

wheat forge
#

ohh ok

stone kayak
#

sorry JavaScript libraries always break, I'll fix when I get home hahaha

brazen eagle
lilac holly
#

No sir @brazen eagle

#

I'm familiar with Python ?

wheat forge
#

why not use bash

#

right tool for the job

hexed flax
lilac holly
#

Thank you for the insight!!

bitter dirge
sleek marsh
#

Anyone understand MIPS pretty well, getting into learning assembly and need some help!

stone kayak
exotic skiff
#

anyone good with c++ in visual studio code?

remote echo
#

Ask what's the question

vernal vigil
#

Whats the question?

exotic skiff
#

im trying to use #include <bits/stdc++. h> but its not working

#

and I am not sure how to fix this even after research

#

and I have MinGW installed

exotic skiff
vernal vigil
#

its not compiling right?

exotic skiff
#

its underlined

vernal vigil
exotic skiff
#

bettt

#

thankssss

#

thats for visual studio

#

im on visual studio code

vernal vigil
#

Dope, there are many solutions given out. Try em, if nothing works out ask here someone might help.
But research first. πŸ™‚

remote badge
sleek marsh
#

@remote badge Thank you!

glass grove
#

is there any way i can encrypt some text using a passphrase in python and then decrypt the text with the same passphrase in javascript

#

pretty much, i want symmetrical encryption. it doesnt have to be cia security, but just encrypted.

tulip sail
#

@glass grove Both those languages will have implementations of a bunch of symmetrical encryption algorithms -- those will be compatible with each other

#

So yes

glass grove
tulip sail
#

Well, look at each of the implementations for it. There'll be a Python implementation and a JS implementation

#

Break it into two separate parts

glass grove
#

mhm

tulip sail
#

No idea if those are any good, but first result on Google

glass grove
#

thanks, ive looked at those already, but ill reread

brazen eagle
#

use AES

#

don't try to roll your own

#

there should be reference implementations lying around

#

probably in the python crypto libraries

#

I think JS might have a crypto lib as well somewhere

#

if it's not already baked into the language

glass grove
#

im dont think ill be reinventing the wheel haha. im just having some trouble understanding aes

brazen eagle
#

plaintext + key goes in, magic happens, ciphertext comes out

glass grove
#

yeh, i thought it was that easy

#

how naive i was πŸ˜…

#

theres like different modes and initialization vectors ugh

brazen eagle
#

ah

#

don't use ECB mode

#

that's crackable if you know some plaintext

#

an IV is generally a nonce

glass grove
#

mhm

brazen eagle
#

CBC is generally fine

#

GCM is probably better

glass grove
#

alri

brazen eagle
#

might help for the JS side

tulip sail
#

pycrypto is outdated, I believe

brazen eagle
#

ah

tulip sail
#

pycryptodome is the replacement iirc?

brazen eagle
#

first hit on google

#

just make sure both ends can handle the same modes

#

yeah ok the IV seems to be stored in the file itself

#

in the example

glass grove
#

alright thanks guys!

glass grove
glass grove
#

@tulip sail @brazen eagle i think i got it, thanks for the help!

exotic skiff
#

int main() {
int n;
int arr[n];
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i];
for (int i = n - 1; i >= 0; i--)
cout << arr[i] << ' ';
return 0;
}

#

anyone know why this isnt running in visual studio?

#

its underlining the n in int arr[n], and idk why

rain ermine
#

I don't see any errors

exotic skiff
#

nahh im running it on windows

#

I might honestly just do my competitive programming stuff on my Vms

violet ermine
#

@exotic skiff providing the compilation error would help in deducing the problem, visual studio can definitely be tricky for beginners

outer jewel
#

Pretty sure that n needs to be a compile time constant for stack based arrays?

#

If you want to create an array of size n basen on input you need to use the heap, google for the new keyword, and remember to delete

violet ermine
#

@outer jewel oh good eye, another easy solution could be std::vector

azure relic
#

underlining is likely cause n hasn't been given an explicit value yet (int n = x, etc)

rigid fulcrum
#

does anyone know a good tutorial for rust

tardy linden
rigid fulcrum
tardy linden
#

You asked for a tutorial πŸ€·β€β™‚οΈ

rigid fulcrum
#

✌️

stone kayak
#

Is there a file for Hugo which specifies which Hugo version to build the website with?

#

Like package.json for Gatsby?

#

If you're looking to set a specific version of a framework your Cloudflare Pages project is using, note that Pages will respect your package manager of choice during your build process. For instance, if you use Gatsby.js, your package.json should indicate a version of the gatsby NPM package, which will be installed using npm install as your project builds on Cloudflare Pages.

stone kayak
#

Hugo on CF Pages is 2 years out of date lol

brazen eagle
#

I don't think there is

hexed raft
#

Has anyone here developed a CyberChef module before? I’ve never developed in node.js and some mentorship would be hugely appreciated πŸ™ŒπŸΌ

dim slate
#

Can anyone explain to me, why, in C does int have 2 possible memory allocation values. Int can be either 16 or 32 bit but I can't find out what decides which it should actually be and why?
Sorry if this is worded badly.

magic falcon
#

Can you provide a bit of context about what you're asking? In an absolute sense memory is allocated based on architecture based word size.

dim slate
# magic falcon Can you provide a bit of context about what you're asking? In an absolute sense ...

OK, so i have a small program, which simply uses sizeof(Data_type) * 8 to return the size of a data type in C in bits. I wrote and compiled this program on 64x windows, using a Borland C/C++ compiler (bcc32) which i believe is 32x.
When comparing sizeof(int) and sizeof(long int) both return a size of 32 bits, the program also returns the range of the variable and obviously, the ranges match given that both are the same bit size. When i refer to documentation for C, long int has a size of 32bits but int can either be 16 or 32 bits. So what goes into consideration when C is determining how much memory to allocate to an int variable. Will an int always allocate to 32 bits on a 64x system and 16 bits on a 32x system (I think this is what your reply is mentioning but i'm not sure).

magic falcon
# dim slate OK, so i have a small program, which simply uses ```sizeof(Data_type) * 8 ``` to...

The compiler decided in each case - Wikipedia has a pretty good article on C data types, and should be used as a base to expand out from.
Sometimes, though, compilers will do weird stuff and do something like what you are talking about - usually it's because the programmer is doing something funky that results in the C standard being not defined for that case, or maybe the compiler isn't very well modernized. Either way, the C standard clearly defines what the size is, and it is all on the compiler to allocate 2B for short int int and [un]signed int.

lilac holly
#

anyone here use MacVim can I ask some questions

true pumice
#

What’s your questions?

lilac holly
#

i use colour scheme has the name "morning" but it has a problem with the colour

#

@true pumice you see the "0" has a white highlight and I don't know how to turn off it

vernal vigil
#

It looks good

lilac holly
#

😫

true pumice
#

Sorry I forgot to respond hah. I have no clue, I don't know anyone who does or use that colour scheme.

lilac holly
#

thanks you i'll change to another one

vernal vigil
#

My only question is, why are you on light theme

solar hull
#

My problem with that is odd kerning.

lilac holly
#

I change them regularly

vernal vigil
#

God you hate yourself dont you.

lilac holly
#

nah i love myself a lot

#

πŸ˜†

brazen eagle
#

Oh gods light mode is so bright :(

exotic skiff
#

does anyone know the name for How is data stored into the stack in x86 architecture?

lilac holly
#

@exotic skiff you mean stack register

tulip sail
tulip sail
lilac holly
#

😫

exotic skiff
#

it was this multiple choice thing

#

I asked cause that was the only question I wasnt sure of

#

its just for fun hah

#

haha*

surreal bronze
#

ok then

lilac holly
#

In order to write a simple program that runs this command --> sudo openvpn Downloads/rokie.ovpn ; will I need to write this in bash or will python suffice?

onyx merlin
#

God don't do that in python

#

Python is crazy overkill

#

Just add it as a bash alias or something

lilac holly
#

Ok bash it is lol

surreal bronze
#

Yeah no don't do it in python

lilac holly
#

#! /bin/bash/roki xD

dull tangle
lilac holly
#

Let's see if i get this right

dull tangle
#

You should see in bashrc where the alias are roughly and just add your own in πŸ™‚

surreal bronze
#

You could also set it up to do Muir's VPN script

lilac holly
#

so i would need to nano ~/bashrc to do this right?

surreal bronze
#

Yup

dull tangle
#

Yea

tulip sail
#

I'd do it with this myself:

alias thmvpn="tmux new -s THMVPN  \"sudo openvpn ~/Downloads/MuirlandOracle-THM.ovpn \""
dull tangle
#

Depends if you use tmux I guess

tulip sail
#

Keeps it nicely backgrounded, means it survives virtually everything short of a reboot, and means you can't have two open at once

#

Oh, I'd just immediately background the session and leave it there πŸ€·β€β™‚οΈ
No actual Tmux use required

#

And it tends to be cleaner shoving it in .bash_aliases rather than directly in .bashrc, but whichever

#

As long as the .bash_aliases file is sourced in .bashrc, which it should be by default for most distros

lilac holly
#

I ran the command you gave @tulip sail and it seems to exit me out

tulip sail
#

Exit you out?

lilac holly
sharp coral
#

did you change the filename

lilac holly
#

here's a screen shot

#

oops

#

no i did not

tulip sail
#

Funnily enough, you don't have a file called ~/Downloads/MuirlandOracle-THM.ovpn

#

That bit needs changed

lilac holly
#

i am an idiot

tulip sail
#

Nah -- happens to everyone πŸ˜„

lilac holly
#

Still having the same problem lol

#

it worked!!!

#

this is utterly amazing !

#

I feel like god

lilac holly
#

Hey, can someone help me with css grids?

#

Can't figure out point d

#

This is what it should look like

#

This is what it currently looks like

tepid cargo
#

wait is this something we should help with? seems like a homework

lilac holly
#

I don't think it affects that much. It's just 1 point ;-;

solar dust
#

How would a music player be for someone starting out?

#

As a project.

true pumice
#

Ah we usually don’t help when it’s point based, you should probably ask your teacher @lilac holly

lilac holly
#
/*this is what Coded for the point*/
footer{
  grid-column: span 2;
}

#

welp shit

true pumice
#

Giving a nudge is fine but when you’re being graded on your knowledge it is unfair.

tepid cargo
lilac holly
#

Could you at-least tell me where I went wrong?

true pumice
#

Have you googled at all?

lilac holly
#

yep, I tried all sorts of code. nothing worked.

true pumice
#

Hold up Leg

#

I think I’m Stupid

lilac holly
#

Even in programming servers. people choose not to answer my question lol

tepid cargo
#

shit πŸ™‚

#

lmao

true pumice
#

Yeah, I pinged you in general, I got the channels mixed up 😁

#

My b

onyx merlin
lilac holly
tepid cargo
#

let me see a little wait

lilac holly
#

Thanks

tepid cargo
#

so in the side1 and side 2 part..

#

did u set a grid-row?

#

cause the side1 is taking 100% height of the container which it should

#

maybe make all the intro article, main article grid-row of 2 and and make the side grid-row of 1

#

and then in the bottom it should automatically align

#

probably check this out

lilac holly
#

yep, I set grid-template-rows to custom sizes.

#

I'm not really allowed to change the html part. I can only mess with grids on the footer i.e the gray areas below.

tepid cargo
#

u don't have to change the html part

#

just use a specific selector

#

or add a class

#

ezpz

lilac holly
#

Ohhhhh

#

it works now. thanks

surreal bronze
solar dust
#

As a project to create.

#

A simplistic one with a UI.

cursive orchid
#

@solar dust well it will boil down to audio tags in html, you can view this page to see more: https://www.w3schools.com/html/html5_audio.asp
but essentially you're going to want to store the audio files (up to you how you handle that)
and then render each one within an audio block
so in pseudocode, something like

<audio controls>
  ForEach song in songs: <source src="song.link" type="audio/mpeg" />
</audio>
solar dust
#

So, it will boil down to finding a way to auto-detect audio files in a user's file directory?

tepid cargo
cursive orchid
#

yeah, so different languages will have different ways to find that

#

for example in node you could use the fs module to read the user's directory

magic falcon
#

it's less auto-detecting and more adding a source path to find files in. Autodetecting would be continuous scanning, which you aren't going to want to do for a variety of reasons

cursive orchid
#

^

tepid cargo
#

one of my first project was a sonic visualizer in flash

#

🀣 actionscript ftw

lilac holly
#

Hey @tulip sail, sorry to bug. The command you suggested seems to reset every time i power down my machine. Is there a syntax to make it persistent ?

solar dust
#

I'm guessing it's a matter of a command to prompt open the file directory to choose anything in a .mp3 format.

lilac holly
#

So convert it from .sh to .mp3?

onyx merlin
lilac holly
#

Okay let me work this out

#

So I copy and paste here correct ?

onyx merlin
#

No . After it.

lilac holly
#

It's not letting me. Not too familiar with vim

onyx merlin
#

You have a random .

lilac holly
#

Wait, you mean this bottom part of my syntax ?

onyx merlin
#

Stop using control z

lilac holly
#

I switched it from aliases to thmvpn

onyx merlin
#

It does not close the program. It backgrounds it.

lilac holly
onyx merlin
lilac holly
#

I'm so confused

#

brb

onyx merlin
#

Simple instructions were given

clear needle
#

just ask your question

sly lake
#

What does this regex do?
const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

brazen eagle
#

good tool I use to understand regexes

wispy tusk
#

I want to make a worm which will automatically be able to replicate and try to pivot itself across the other devices in same private network in which the victim pc is connected. The worm will also contain a reverse-shell payload and send me a shell from all the computers it has successfully pivoted to. Also the worm needs to be executed only once and it will automatically execute the next worm in the daisychain.. It will also create cronjobs/services which will be run at boot to maintain the access. How do I achieve this? I want to use python for coding it. Any good resources/references which can be helpful?

tulip sail
#

@wispy tusk Do I want to know why?

wispy tusk
#

I love making challenging tools which will help me learn a lot along the way.

tulip sail
#

That's illegal in enough places (to develop, not deploy), that I'm gonna say please don't ask here for it. Not a warning as much as a request there πŸ˜„

#

I can see where you're coming from with an educational perspective though, so if you do try it, keep it safe in a VM network and don't deploy it elsewhere

wispy tusk
#

Ooh...πŸ˜…πŸ˜… okay..no issuesπŸ˜…

wispy tusk
tulip sail
#

I personally would suggest against it, purely because there aren't many legitimate uses for other people to use it. I can see why coding it would help educationally, but chances are people will deploy it if you make it open-source.

#

Equally, it's outright illegal to develop that kind of thing, dependent on where you live. If you're in the UK then I would strongly suggest against it

wispy tusk
#

Ahhh... Alright.

ebon jackal
#

idk Im being pixel perfect and still getting inconsistent positions

#

Im using a 19.2x10.8 graph

#

placing the points where I want them to be

#

then just multiplying their positions by 100 and adding those values to the points in my code

#

but its really not pretty and idk why

ebon jackal
#

ooooo I think I found it out

#

:D

brazen eagle
#

aliasing?

ebon jackal
#

nah I still dont know lol

#

I tried my best I cant get it to be pretty

stone kayak
#

My program relies on Hashcat, how can I get Hashcat in CI? How can I test the Hashcat module works in CI? πŸ˜›

steady anchor
#

import os
os.system("hashcat")

#

sry

#

i am just sad they killed yahoo api

brazen eagle
#

Is there a hashcat docker image?

pine apex
magic falcon
sly breach
#

Or at the least when I last pulled ~4-6 months ago I might have to fact check

#

you're largely limited by the gen of CPU (i.e. if it's cloud based) which is where I had most of the issue getting the correct SDK's for but

#

if you're asking about cloud lemme know what provider & tier and I can probably point you in the right direction in terms of all of the above :^ I'm v sure I still have intel SDK's that were and absolute pain to obtain

#

plus IIRC you can just -d "string here" "dict/ruleset" and you're a given

hollow bison
#

anybody here know c++

#

quiet confusing why isn't this simple loop grow

#

i thought the array will have every single value of i

#

debugger didn't detect it

solar hull
#

I think the debugger only shows the value at *test, that is test[0]

brazen eagle
#

that

#

try evaluating test[4]

lilac holly
#

anyone familiar with nginx cipher suite configuration files?

#

no matter how i update the "Ssl ciphers" field, the resulting supported ciphers doesn't change

#

not sure what's causing this

brazen eagle
#

did you read the doc?

surreal bronze
#
import time
start = time.time()

while function is running:
    print(f"{time.time() - start}", end="\r")
#

How would It time a function but print what the current time is

#
import time
import functools

def timer(f):
  @functools.wraps(f)
  def wrapper_timer(*args, **kwargs):
    start = time.time()
    result = f(*args, **kwargs)
    print(f'Time taken: {time.time() - start}')
    return result
  return wrapper_timer

@timer
def get_result():
    time.sleep(10)
    print("Done")

get_result()

This works, but it only prints the time at the end...I want it to continually be printing how long it takes (like above) while the function is running

true pumice
#

I’m unsure what you mean?

surreal bronze
#

Might need to do threading

#

hmm okay,

#

while True:
    print(f"{time.time() - start}", end="\r")
#

If you run this, it will act like a stopwatch and keep on printing the time elapsed since you started the program

#

I want it to do this, while a function is running

true pumice
#

You want it to continually count up while the program is running?

surreal bronze
#

exactly,

#

but it has to keep printing the time elapsed since the program / func is running

true pumice
#

Give me a moment to clean up

surreal bronze
#

kk

#

Something like this

#

Im kinda there

#

nvm.

surreal bronze
#

okay

#
import threading 
import ctypes 
import time 
   
class thread_with_exception(threading.Thread): 
    def __init__(self, name): 
        threading.Thread.__init__(self) 
        self.name = name 
              
    def run(self): 
  
        # target function of the thread class 
        try: 
            start = time.time()
            while True:
                print(f"{time.time() - start}", end="\r")
        finally: 
            print('ended') 
           
    def get_id(self): 
        if hasattr(self, '_thread_id'): 
            return self._thread_id 
        for id, thread in threading._active.items(): 
            if thread is self: 
                return id
   
    def raise_exception(self): 
        thread_id = self.get_id() 
        res = ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, 
              ctypes.py_object(SystemExit)) 
        if res > 1: 
            ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, 0) 
            print('Exception raise failure') 

def start_timer():
    t1 = thread_with_exception('Thread 1') 
    t1.start()
    time.sleep(5)
    t1.raise_exception() 

start_timer()
#

So turns out you cant force kill a thread, you have to have the thread "fail" / raise exception

#

its messy but it works

true pumice
#

Okay, I am back at my PC.

surreal bronze
#

Ah nice, I sorted it but if you can find any other way (without using global) that would be amazing πŸ˜„

#

its quite a fun challenge to

#

@true pumice

true pumice
#

Are you entirely set on threading?

surreal bronze
#

I couldn't think of any other way

#

Yes you could use global without threading

#
from time import time, sleep
from _thread import start_new_thread

def long_function():
    global finished
    sleep(20.5)
    finished = True

def time_function(func):
    global finished
    finished = False
    start = time()
    thread = start_new_thread(long_function, ())
    while finished != True:
        sleep(1)
        current = time()
        print('Time Elapsed: ' + str(current - start))
    end = time()
    print('Finished after: ' + str(end - start))

time_function(long_function)
#

Something like that would work without threading

#

but it uses global which I would rather not do

true pumice
#

@surreal bronze This is a sloppy way of using asyncio in python. It seems to do the job.

import asyncio, time

async def func(delay, what):
    await asyncio.sleep(delay)
    print(what)

async def main():
    start = time.time()
    
    task = asyncio.create_task(
        func(10, 'hello'))

    while True:
        if task.done():
           break

        else:
            print(time.strftime("%H:%M:%S", time.gmtime(time.time()-start)))
            
        await asyncio.sleep(1)

        
asyncio.run(main())
brazen eagle
#

probably an existing lib

true pumice
#

Technically there is, time works perfectly fine. Jayy wants it to continually output how long the program was been running for which is a little hard to do without threading or concurrency etc.

brazen eagle
#

Ah ok

#

I used tdqm to make a progress bar thingy recently but you want a spinner, basically ye?

true pumice
#

I looked into using a spinner, I used one when I originally got into threading but some of the code was outdated so I scrapped it 😁

sharp coral
true pumice
#

I try to stay with base libraries if I can.

surreal bronze
surreal bronze
brazen eagle
#

\r doesn't work on Windows, unless they fixed that

surreal bronze
#

It works with powershell

#

Not cmd

#

@brazen eagle

#

(With the new windows terminal)

brazen eagle
#

so they did fix that cool

#

( I haven't use \r like that for at least a decade....)

surreal bronze
#

I use it all the time haha

brazen eagle
#

I don't do much on the CLI these days

#

most users want their shiny buttons

#

but apparently this is too shiny

background-image: gradient(linear, left top, right top,
        color-stop(0, red),
        color-stop(0.15, orange),
        color-stop(0.3, yellow),
        color-stop(0.45, green),
        color-stop(0.65, blue),
        color-stop(0.8, indigo),
        color-stop(1, violet)
      );
#

(yes I did do that to a highlight effect in dev)

#

because the client couldn't decide what colour to make it

cursive orchid
solar dust
#

Hey, can I get some help real quick?

#

I'm trying out a problem, but I feel like I'm doing something wrong.

surreal bronze
#

Sure, what do you nee help with?

#

@solar dust

brazen eagle
balmy flint
#

Hi I need some help with lists...
I want to make a list of lists which have to be immutable when assigned to another variable

B=A```

If A is modified B won't have to modify 
I searched up but didn't able to find a solution ...
night orchid
#

from tello import Tello
import sys
from datetime import datetime
import time

start_time = str(datetime.now())
tello = Tello()

def int():
tello.send_command("command")

def takeoff():
tello.send_command("takeoff")

def land():
tello.send_command("land")

def battery():
tello.send_command("battery?")

def delay(argv):
print('delay for %s' % argv)
time.sleep(argv)

def forward(argv):
tello.send_command('forward %s' % argv)

def back(argv):
tello.send_command('back %s' % argv)

def left(argv):
tello.send_command('left %s' % argv)

def right(argv):
tello.send_command('right %s' % argv)

def flip(argv):
tello.send_command('flip %s' % argv)

def turn_left(argv):
tello.send_command('ccw &s' % argv)

def turn_right(argv):
tello.send_command('cw &s' % argv)

def mission_pad_enable(argv):
if argv == 1:
tello.send_command("mon")
elif argv == 0:
tello.send_command("moff")
else:
print("Error_mission_pad_enable")

def mp_direction(argv):
# 0 = Enable downward detection only
# 1 = Enable forward detection only
# 2 = Enable both forward and downward detection
if argv == "0":
tello.send_command("mdirection 0")
elif argv == 1:
tello.send_command("mdirection 1")
elif argv == 2:
tello.send_command("mdirection 2")
else:
print("Error in mdirection")

def mpad_go():
mission_pad_no = input("Which mission pad do u want to detect ? ")
xyz = input("What is the coordinate [x y z] ? ")
speed = input("What is the speed of the drone ? ")
temp = "go "+xyz+" "+speed+" "+mission_pad_no
tello.send_command(temp)

def mpad_curve():
mission_pad_no = input("Which mission pad do u want to detect ? ")
xyz1 = input("What is the first coordinate [x y z] ? ")
xyz2 = input("What is the second coordinate [x y z] ? ")
speed = input("What is the speed of the drone ? ")
temp = "curve "+xyz1+" "+xyz2+" "+speed+"

night orchid
#

def action(i):
if i == "o":
takeoff()
elif i == "l":
land()
elif i == "w":
distance = input(" please enter the distance (20-500): ")
forward(distance)
elif i == "s":
distance = input(" please enter the distance (20-500): ")
back(distance)
elif i == "a":
distance = input(" please enter the distance (20-500): ")
left(distance)
elif i == "d":
distance = input(" please enter the distance (20-500): ")
right(distance)
elif i == "b":
battery()
elif i == "write":
com = input("Please input the command : ")

balmy flint
night orchid
#

int()
battery()
'''
try:
while True:
print("Command 😊
print("o - takeoff l - land")
print("w - forward a - left s - back d - back")
print("m - mission pad enable n - mission pad disable")
print("j - mission pad detection direction")
i = input("Please enter a command 😊
print("you enter "+i)
action(i)
except:
KeyboardInterrupt()
'''
takeoff()
forward(50)
left(50)
land()

true pumice
#

@night orchid Please paste your script into repl.it and share the link.

night orchid
#

βœ‹πŸ‘Œ

true pumice
#

@balmy flint So you want two lists, one of which is immutable and the other that is modified?

balmy flint
#

Yes both are same and if one is modified it won't affect the other

true pumice
#

Is the program small enough to be shared here?

balmy flint
#

To me ?

true pumice
#

This is the first way that came to mind.

#
def list_duplicator(list):
    return [item for item in list]

A = [1,2,3]

B = list_duplicator(A)

print("List A:", A)
print("List B:", B)
print("\nRemoving an item from List A")
A.pop()
print("List A:", A)
print("List B:", B)

Output:

List A: [1, 2, 3]
List B: [1, 2, 3]

Removing an item from List A
List A: [1, 2]
List B: [1, 2, 3]

Using a function that returns the values using list comprehension means that you can continually re-use the function to do this for multiple lists. @balmy flint

balmy flint
true pumice
#

What version of Python?

balmy flint
#

Well it's a website for coding ...it says 3.x

brazen eagle
#

would need a deep copy, ye?

balmy flint
#

deepcopy ?

true pumice
#

Mhm

brazen eagle
#

hmm, I really don't know how python's object model works

sage urchin
brazen eagle
#

is it references everywhere?

true pumice
#

This is a simple as I can get it in python 3.9.1:

A = [1,2,3]
B = [item for item in A]
brazen eagle
#

dunno if the items are independent there @true pumice

true pumice
#

Hm?

#

What do you mean?

brazen eagle
#

for ints then sure, but for objects they'd be pointing to the same object no?

true pumice
#
A = [1,2,3]
B = [item for item in A]

print(A)
print(B)
A.pop()
print("List A:", A)
print("List B:", B)

Output:

[1, 2, 3]
[1, 2, 3]
List A: [1, 2]
List B: [1, 2, 3]
novel cobalt
brazen eagle
#

Assignment statements in Python do not copy objects, they create bindings between a target and an object.

#

from the python doc

balmy flint
#

Well if I doing with copy or deepcopy both the lists get completely immutable in my case

true pumice
novel cobalt
brazen eagle
#

yeah but does list do a deep copy or a shallow copy?

novel cobalt
#

deep copy..... iirc

balmy flint
#

Would I rather post a code of mine...and the output ..!

true pumice
#
A = [1,2,3]
B = list(A)
A.pop()
print("List A:", A)
print("List B:", B)
List A: [1, 2]
List B: [1, 2, 3]
true pumice
brazen eagle
#

if I had

A = [obj1, obj2]
B = list(A)

obj1.field = "Modified Field"

would obj1 change in both lists?

#

as both would be bound to the same target?

true pumice
#

If you are storing values in a list, I am sure they are references

balmy flint
#

Is b= list (a) is different from b=a

true pumice
#

What is it called πŸ€”

#

Pass through reference?

brazen eagle
#

pass by ref?

true pumice
#

Possibly

brazen eagle
#

that's generally for functions

#

B = list(A) calls a constructor for list using A as an initialization param

#

I assume

true pumice
#

I am pretty sure this is being taken out of scope

brazen eagle
#

maybe

true pumice
brazen eagle
#

if list is only holding ints, then it's fine

#

if list is holding objects, then be careful

#

as the objects are not independent between both lists

balmy flint
#

I am having list of strings

brazen eagle
#

primitives are pretty much immutable

true pumice
#
A = [[1,2,3], [1,2,3,4]]
B = list(A)

print("List A:", A)
print("List B:", B)
A[1].pop()
print()
print("List A:", A)
print("List B:", B)
List A: [[1, 2, 3], [1, 2, 3, 4]]
List B: [[1, 2, 3], [1, 2, 3, 4]]

List A: [[1, 2, 3], [1, 2, 3]]
List B: [[1, 2, 3], [1, 2, 3]]

Yup, you are right hydra.

brazen eagle
#

it's a super common error

true pumice
#

Objects work differently, luckily when embedded objects in lists I don't usually create list copies.

brazen eagle
#

because pointers are hard

#

@true pumice if you do a deepcopy, then they'll be independent

true pumice
#

Eh, no need

#

I found a workaround a little while back for my programming assignment 😁

brazen eagle
#

oh dear

surreal bronze
#

What's up πŸ˜„

true pumice
#

(I re-wrote the program so I didn't have to use them because they're icky and I hate pass by reference)

brazen eagle
#

pass by reference is useful

balmy flint
#

I'm modifying the contents of lists by assigning to some string...so will it hold for deepcopy?

true pumice
#

It is above my pay grade.

brazen eagle
#

but also tricksy tricksy

#

naw should be fine for strings

#

might want to test that though

balmy flint
#

Oh no its not for me hereπŸ˜‚

true pumice
#

Okay, it is coffee time

brazen eagle
#

tea time!

balmy flint
lilac holly
#

Hey @tulip sail sorry to bug you, but can you send me the alias syntax for the thmvpn so I can added it to my .bashrc por favor. Much appreciated my friend

steady anchor
#

@lilac holly

#

alias thmvpn="tmux new -s THMVPN \"sudo openvpn ~/Downloads/MuirlandOracle-THM.ovpn \""

lilac holly
#

Hey thank you !! 😊

steady anchor
lilac holly
#

Is the backslash the same as piping??

#

\sudo @steady anchor

steady anchor
#

it is for new line i think

#

or character escaping kekw

lilac holly
#

Like pythons \n

steady anchor
#

yeah it is for character escaping in bash

lilac holly
#

Noiiiiiice

solar hull
#

above, that " encapsulates a series of words separated by spaces into a single string. As " would end that string, to include double quotes inside the string, they need to be escaped. And that's what \" does.

lilac holly
#

Woah. You are like mind reader. I too was wondering why it only had double quotes at the end and not the beginning

solar hull
#

so the value of that alias called thmvpn is tmux new -s THMVPN "sudo openvpn ~/Downloads/MuirlandOracle-THM.ovpn " after those escaped double quotes are unescaped.

lilac holly
#

And tmux new -s stands for new session correct?

solar hull
#

I'd guess that names the session.

#
                   (alias: new)
``` Seems like that.
lilac holly
#

got it thanks

wind crane
#

Hi, I'm following an app to learn ethical hacking. I executed this :

#!/bin/bash
for ip in seq 1 254 ; do
ping -c 1 $1.$ip | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" &
done

But when executing in the terminal it says "xxx.xxx.1.seq: Name or service not know" (with the x being my ip ofc)

wind crane
#

@ me when answering please

#

(If someone ever answers)

lilac holly
#

list = [] thats a tropul right?

#

tropel

#

something like that

true pumice
#

No

#

That’s a list

#

A tuple is ()

lilac holly
#

oh okay thanks

wind crane
lilac holly
#

name = "emil"
age = 15

io.write("The age of", name, "is " , age, \n)
(lua)
i cant seem to get it to work, does anyone know what i have done wrong?

(SOLVED)

brazen eagle
#

quotes around the \n?

#

for the record, use triple backticks to wrap code in a block

sour apex
#

This might be a dumb question but I really want to know

#

Does importing many modules increase the size of a script

onyx merlin
#

Of the script? No.

#

The script is just pure text.

sour apex
#

Ok does it make the script run slow?

onyx merlin
#

It will increase the footprint in RAM potentially, because it's gotta hold more references and stuff

#

Don't import stuff you're not using, because that's poor practice.

sour apex
#

Ok thanks a lot

brazen eagle
#

Generally we want to try to import exactly what we need

wind crane
#

Hi, apparently, Kali can't down the eth0 interface (not allowed to)
How can I change that ?

wind crane
#

@ me when answering, ty

onyx merlin
#

That doesn't seem like a programming question?

dusky niche
#

Someone good in C language and reverse engineering?

onyx merlin
#

Just ask your question

dusky niche
#

I am making a ctf. First one. So when running the program you need to enter a key. You will get the flag when submitting the right key. But the key is hidden and the flag not

#

Idk how to hide that.

#

Someone told me to encrypt it

#

But I tried it 1 way. It did work. But when using radare2 it showing the flag

#

But its hidden with string and ltrace

#

So you know how to do it?

brazen eagle
#

encrypt it outside the program, and decrypt it live, or encrypt the input and compare against the encrypted flag

#

you'll probably want to hash it

#

and then compare the input hash with the hashed flag

#

unless you want then to grab the flag from the code

#
fun check_key( String input ) {
  return decrypt(encrypted_flag, key);
}
#

something like that might work

onyx merlin
#

What's the goal of the challenge anyway?

brazen eagle
#

it'll output gibberish if the key is invalid

onyx merlin
#

Because just use the movfuscator.

brazen eagle
#

that's mean...

#

also you can debug though that no?

onyx merlin
#

You haven't seen my next box.

#

Uhhhh

brazen eagle
#

blackbox it is

#

but yeah depends on the goal

shrewd raft
#

Where i can send an imgae of my code?

#
            try
            {
                WebClient wb = new WebClient();
                string Script = wb.DownloadString("https://pastebin.com/raw/LGGkpfBL");
                if (Script == "v0.7")
                {
                    bunifuCustomLabel1.Visible = (true);
                    // I need you to wait 5 seconds when I get here like I  do
                    bunifuCustomLabel1.Visible = (false);
                    bunifuCustomLabel3.Visible = (true);
                }```
#

C#

#

Dont timer on the start, timer on button click
I need them to be since I clicked the button

true pumice
#

Did you mention this was an exploit?

shrewd raft
#

and hack my own roblox game

#

πŸ™‚

true pumice
#

Ohh no

#

We do not do that here.

#

In order to make Roblox cheats you need permission from Roblox

shrewd raft
#

no, but for test my system secure

#

i have a team

#

i am on the testing secure now

true pumice
#

Do not think you are reading what I am saying.

shrewd raft
#

?

#

can you be more specify please

#

i speak spanish

true pumice
#

In order to exploit a game engine, you need explicit permission from the game creator.

#

Creating cheats for Roblox is against Roblox's Terms of Service, is unethical and in some cases illegal.

#

Not only that, but from experience when you have permission from Roblox, they usually do not like you discussing this with others users.

shrewd raft
#

But that is only for owners of the game

#

for test security

true pumice
#

Does not matter.

shrewd raft
#

pls bro help me

true pumice
#

They do not own Roblox.

shrewd raft
#

But we only need to add security for my game

#

please

#

i need to test it

#

:c

#

ok

onyx merlin
#

-warn @shrewd raft Please stop discussing illegal activities here, Jabba already stated that we don't do that here

wispy kestrelBOT
#

⚠ Warned ManiustBCT#3877

dusky niche
lilac holly
#

Hello guys, are there any C programmers here?

brazen eagle
dusky niche
#

I want send the program, so you can tell me how I can change it.

dusky niche
brazen eagle
#

Sorry not too available at the moment, post your problem here and maybe we can crowdsource it

floral wedge
#

Hey,
I want to write a small application that helps me to keep track of summoner spell cooldowns in League of Legends, nothing fancy, just functional. I'd love to have it on an overlay on top of the game, but if that makes it a lot more complicated, then idc about it as much. Now to the question: Do I have to worry about resource usage of my machine (and therefore worse game performance) with such a small application and if so, which language would be appropriate to use or does it even matter at all?

bitter field
floral wedge
#

Oh, I didn't know that. I'll look into it but will probably do it myself anyway. Thanks!

floral wedge
#

I just found that as well :D

sharp coral
floral wedge
sharp coral
#

okay cool, well my super naive solution would be building a keylogger in python to listen for ability key-presses and have those trigger some timers and then have some simple GUI to house it all off-screen

#

the right solution would probably involve tracking down the existing HUD resources and doing a little reverse-engineering to figure out how they interact with the game client

#

and if there's custom UIs online that streamers use you could also track those down and maybe see if there's any useful functions you can rip from github

floral wedge
#

What you said first is kinda what I'm going for, the "right" solution is a bit out of my current comfort zone with such programming (never really did sth like that before and would have to Google more than usual) and I don't want to spend too much time on it since it was just a quick thought I had today. I only ever wrote small programs for the trash can as a matter of learning the concepts in school, never did anything useful or applicable in a real world scenario, so I'm not too experienced.
Thanks for the input!

onyx merlin
red wave
#

Question: I have an assignment that wants us to do operations such as A = B * 16, A = B *17, etc in a single instruction using ARM assembly (where signed integers A and B are saved in r0 and r1) . Now, since the MUL instruction only accepts registers and not immediate numbers, for the first one I just went with LSL r0, r1, #4 (aka a left shift by 4 bits). Obviously this doesn't work for something like A = B *17 because that's not a multiple of 2, so I'm totally stuck. Help?

onyx merlin
#

where signed integers A and B are saved in r0 and r1) . Now, since the MUL instruction only accepts registers

#

So

#

Oh, right nevermind I see the issue

red wave
#

Yeah the single instruction part is what makes it tough here

onyx merlin
#

Maybe talk to your teacher and say "I think it's impossible because of these well thought out concepts, do you have any advice?"

red wave
#

I think according to the specific problem description, going the route of ADD + bitshifting is an acceptable way to solve the problem? So this helps a lot, thank you!

onyx merlin
#

Maybe it's worth discussing the limitations in whatever you're submitting?

red wave
#

Probably, yeah

outer jewel
#

Probably not at all what you want. Thanks for the exercise "how to google something you don't know, and trying to find a relevant answer" though. :))

#

Edit: shift right... Embarrassed 😳

coral grotto
#

does someone kow how to code ssl reverse shell using pipes i tried to do it but i t sends a lot of thrash data

#

i m trying to to do it in c language

prisma thorn
#

alright, so using cpp, because I want speed and other reasons

I am trying to iterate through the argv list, in order to get arguments like -p -o etc
however, when I run the code without the little things I added, it compiles/runs fine, but adding the below code gets me

terminate called after throwing an instance of 'std::logic_error'
what():  basic_string::_M_construct null not valid

This is the code

for (int i=1; i<=argc; i++) {
        string argument = argv[i];
        if (argument.compare("-p") == 0) {
            cout << "You want a password checked?\n";
        }
    }

Any ideas as to why?

#

I figured it out.
I was getting an OOB from the i<=argc

brazen eagle
#

Yeah you want 0 < argc

#

Array indices in C begin at 0

prisma thorn
#

I know that, but argc[0] is the name of the program, which I don’t need

brazen eagle
#

Point

#

Argv[0]

prisma thorn
#

Sorry, I meant argv

shrewd raft
#

How to make an .then

#

on C#

cursive orchid
#

big question mark to the above question

#

does c# even have promises

#

i'm using react and i'm trying to dynamically load md files, however i have no idea how to approach this

#
import file from '../blogs/Test.md';

fetch(file)
    .then((res) => res.text().then(console.log))
    .catch(console.error);
#

this is my current code which loads the file just fine

#

however, i need to get the blog id from the url, and load that blog, rather than Test

#

but react insists that import statements be at the top of the file

#

and using require to get the file doesn't work for some reason

#
import file from '../blogs/Test.md';

const Blog = (props) => {
  const { blog } = props.match.params;

  fetch(file)
    .then((res) => res.text().then(console.log))
    .catch(console.error);

  return (
    <>
      <h1>{blog}</h1>
    </>
  );
};

export default Blog;

this is the full file atm

crisp turtle
#

Isn't fetch for http requests? So, couldn't you just pass it a string or whatever?

cursive orchid
#

if i pass it a string then it for some reason grabs the index.html

#

fetch('../blogs/Test.md')

crisp turtle
#

Are the md files available through the webserver? I know react is a client side framework so, you would need a webserver to host the MD files.

magic falcon
cursive orchid
#

but no worries, i got it working

#
import { useEffect, useState } from 'react';

const Blog = (props) => {
  const [blog, setBlog] = useState('');
  const [error, setError] = useState(false);

  useEffect(() => {
    const url = `http://localhost/blogs/${props.match.params.id}.md`;

    const getBlog = async () => {
      const response = await fetch(url);
      const file = await response.text();

      return file.includes('<!DOCTYPE html>') ? setError(true) : setBlog(file);
    };

    getBlog();
  }, []);

  return (
    <>
      <h1>beep</h1>
    </>
  );
};

export default Blog;

works just fine

livid nebula
#

I am new in the cyber sec

#

must Δ± learn python

tulip ibex
#

hi I am new in the cyber sec, im light

#

and

#

not compulosory

tidal panther
livid nebula
#

I think to learn at a normal level

tidal panther
#

sure just learning some can be helpful

true pumice
#

@tulip ibex Lets try not to make fun of anyone.

shrewd raft
#

who have a simple code to save file of a text

#

i am making my notepad

#

no save as

#

only save as .txt

true pumice
#

What programming language?

shrewd raft
south egret
#

I have a question what is a good programming language if I want to work with Networks?

lilac holly
#

Python can be good.

limber ore
#

!p sky playboi carti

regal girder
#

hi, i am trying to program a unix shell in c, the shell is executing commands thought execvp, buildin commands in c and parsing spaces and pipes, right now i am trying to, when the program ./shell is called with a scriptfile, to read the file, parse the commands and execute them and then quit but i am getting an error when executing them even though i can print the commands in that same part of the code, anyone here wouldnt mind giving me a hand if possible please

#

`void execScript(char **argv)
{
FILE fp;
char buffer[1000];
char
buf;

if ((fp = fopen(argv[1], "r")) == NULL){
    printf("File >>> %s <<< not found.\n", argv[1]);
    printf("Quitting...\n\n");
    exit(0);
}
else {
    // open file and parse commands
    printf("Executing from file...\n");
    while (fgets(buffer, 1000,fp) != NULL) {
        buf = buffer;
        add_history(buf);
        // and execute command
        execParsedArgs(buf);
        //printf( "%s\n" , buffer); 
    }
    fclose(fp);
    exit(0);
}   

}`

#

`void execParsedArgs(char** parsed)
{
// Forking a child
pid_t pid = fork();

if (pid == -1) { 
    printf("\nFailed forking child"); 
    return; 
} else if (pid == 0) { 
    if (execvp(parsed[0], parsed) < 0) { 
        printf("\nCould not execute command error: 0\n"); 
    } 
    exit(0); 
} else { 
    // Waiting for child to terminate 
    wait(NULL);  
    return; 
} 

} `

peak mango
#

@shrewd raft
> who have a simple code to save file of a text

System.IO.File.WriteAllText(content, $"{name}.txt")?

lilac holly
#

hi

#

import pyttsx3
import speech_recognition as sr
import pyaudio

engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[1].id)

def speak(audio):
engine.say(audio)
engine.runAndWait()

def takecommand():
r= sr.Recognizer()
with sr.Microphone() as source:
print("Listening....")
r.pause_threshold = 1
audio=r.listen(source, timeout=1,phrase_time_limit=5)

try:
    print("Recognizing...")
    query = r.recognize_google(audio,language='en-in')
    print(f"User Said: {query} ")

except Exception as e:
    speak("Please say that again...")
    return "none"

return query

if name == "main":
takecommand()

#

C:\Users\Amit\AppData\Local\Programs\Python\Python39\python.exe "C:/Users/Amit/PycharmProjects/private project/jarvis.py"
Traceback (most recent call last):
File "C:\Users\Amit\PycharmProjects\private project\jarvis.py", line 38, in <module>
takecommand()
File "C:\Users\Amit\PycharmProjects\private project\jarvis.py", line 17, in takecommand
with sr.Microphone() as source:
File "C:\Users\Amit\AppData\Local\Programs\Python\Python39\lib\site-packages\speech_recognition_init_.py", line 138, in enter
self.audio.open(
File "C:\Users\Amit\AppData\Local\Programs\Python\Python39\lib\site-packages\pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "C:\Users\Amit\AppData\Local\Programs\Python\Python39\lib\site-packages\pyaudio.py", line 441, in init
self._stream = pa.open(**arguments)
OSError: [Errno -9999] Unanticipated host error

Process finished with exit code 1

sharp coral
lilac holly
#

this solved the problem

brazen eagle
#

you can use code blocks with three `

cunning zephyr
#

Hi, I am trying to automate the blind sql injection with conditional responses lab and this is supposed to give letter or number for position 1 in the password. Although this doesn't give any error, it also doesn't give the desired result. Where is the error?

mossy meadow
true pumice
#

joy21, have you tried printing out the whole response to see if the desired response is there?

#

( @cunning zephyr )

cunning zephyr
cunning zephyr
true pumice
#

Is your payload 100% correct?

cunning zephyr
#

yes. it works in burp.

lilac holly
#

Hi, I'm working on tool that checks MD5 hashes .. and I wonder if it's possible in python to make update just the variable with hashes on screen without having to clear whole screen

#
output:
TRYING HASH: '{Hash variable}'

Is it possible in python to update only that variable without clearing whole screen ?

true pumice
#

You can do this!

#

Here is an example I wrote up:

import os, time

for x in range(20):
    with open("example.txt", 'a') as file:
        file.write("test")
        
    print(os.path.getsize("example.txt"), end='\r')
    time.sleep(1)

The print statement, like all functions, takes parameters. The key one is end.

https://docs.python.org/3/library/functions.html#print

( @lilac holly )

lilac holly
#

I'll try it

#

ty very much

lilac holly
shy socket
#

alternatively use curses

#

quick example like :

#
import curses
import time
stdscr = curses.initscr()
stdscr.clear()
stdscr.addstr(0, 0, "[i] CRACKING HASH : ")
stdscr.addstr(0, 20, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
stdscr.refresh()
time.sleep(1)
stdscr.addstr(0, 20, "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
stdscr.refresh()
time.sleep(1)
stdscr.addstr(0, 20, "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
stdscr.refresh()
curses.endwin()
#

AAAAA .... being the hash

#

if hash is not same length the use stdscr.clrtoeol() after each addscr to remove excess chars

lilac holly
#

ty

#

I was looking to curses rn

#

this helped me alot

#

ty

shy socket
#

btw the 20 in the addstr is the character number where it puts the cursor on the line

dusty ore
#

Anyone here knows pascal? I need help

onyx merlin
#

-warn @dusty ore Please do not use homophobic language

wispy kestrelBOT
#

⚠ Warned JohnLmao#3515

dusty ore
#

Oh im sorry

tidal panther
#

Pascal is a blast from the past

brazen eagle
#

I wasn't aware people still used that language

frozen smelt
#

Hey, I wanted to ask about the re module in python , is there way to print the whole line where the re was matched, i currently have it only matching the word and just printing out the word?

true pumice
#

RE module?

frozen smelt
#

yes

true pumice
#

Oh Regex

frozen smelt
#

Its something like this :

        title = "<title>"
        stringwewant = re.findall(title, r.content,flags=re.MULTILINE)
        print("############## This for the Request" + str(x) + " ##############")
        print(stringwewant)
true pumice
#

I'm slightly confused on what you are asking.

frozen smelt
#

yes let me try to ellabrate a little more

#

soo i am trying to fuzz an endpoint , and do a get request on that endpoint and then grep on the <title> html tag , and get the contents of that tag

true pumice
#

Ah, I get you now.

#

Give me a moment.

#

Are you completely strapped to using RegEx?

frozen smelt
#

nopee

true pumice
#

This is something I threw together.

#
import requests
from bs4 import BeautifulSoup

url = 'https://example.com/'
r = requests.get(url)
soup = BeautifulSoup(r.text)

for tags in soup.find_all("insert_tag_here"):
    print(tags)
frozen smelt
#

Ohh thank you, i will take a look at at the beautifullsoup library and use this

true pumice
#

Mhm, no problem.

frozen smelt
#

Thanks it worked 7190_linkpepehype

fathom prism
#

Where do i learn about haking

magic falcon
brazen eagle
#

I know, I'm just surprised

magic falcon
#

fair

#

a lot of scientific researchers still use fortran, too. The newer generation prefers python, but the PIs are all really old and prefer tools they know

brazen eagle
#

there's R as well

#

for stats stuff

magic falcon
#

It doesn't get used as much, though. R can be a weird beast to get around, since a lot of the libraries are really inconsistent in rigor and quality

brazen eagle
#

so...like python πŸ˜„

magic falcon
#

considerably more inconsistent though

#

as much hate as pep8 gets, it does mandate a certain amount of consistency... R doesn't really have any style guides

coarse eagle
dire vortex
#

anyone able to help a little with C

#

I'm trying to use the ioctl function, but to no avail

magic falcon
#

post your code and error please

dire vortex
#

you mind if I pm? @magic falcon

magic falcon
#

just post here

dire vortex
#
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/fs.h>

int main()
{
    FILE *fp;
    char test[7] = "testing";
    int val = FS_IMMUTABLE_FL;
    fp = fopen("test.txt", "w+");
    fwrite(test, sizeof(test[0]), sizeof(test)/sizeof(test[0]), fp);
    ioctl(fileno(fp), FS_IOC_SETFLAGS, &val);
    fclose(fp);
}```
#

I'm trying to use that FS_IMMUTABLE_FL flag, but it doesn't seem to have any effect

upbeat oar
#

hey there i have a quick question
can i change permisson of a file in a bash script
i have been trying for a while now like : sudo chmod $file_name +r +w +x
any tips?

onyx merlin
#

Look at the syntax of chmod and compare it to what you're doing

upbeat oar
#

oh i just figured it out πŸ˜„ thank you

magic falcon
dire vortex
#

ahh, there's a very high chance of that πŸ˜‚

wheat onyx
#

Anyone know if there is a way to make a .bat file that is located on a usb 3.0 drive run when i plug it into a computer? like I take the usb, plug it into a pc and then it auto runs the .bat file?

true pumice
#

Why would you want to do that?

wheat onyx
#

i made a script that opens a new window and plays never gonna give you up every 3 mins

onyx merlin
wheat onyx
#

thats kinda what I was thinking, like with autorun.inf being patched a long time ago and stuff

#

is there any sort of device/product that can do what I want to do?

true pumice
#

Yes but the user would need to install it on their computer first.

wheat onyx
#

hmm

#

okay well thanks for the help

arctic meteor
#

does anyone know how to save a c# fourms .net file?

#

like on your windows desktop

#

or something

snow smelt
#

I have a fucking programming quiz for you that is messing with me being noobie for the last hour...

(C++) Lets say that i have a string s = "fc4883e4"
How can i get the byte array [4] = {0xfc, 0x48, 0x83, 0xe4}

who ever solves this i give a cookie (not a session one)

brazen eagle
#

or some similar function

#

or strtol

steady anchor
#

my idea was to take the hex value mask it and then use right shift operator and store it in an array

novel pulsar
steady anchor
# snow smelt I have a fucking programming quiz for you that is messing with me being noobie f...
#include <iostream>

using namespace std;

int main()
{
    unsigned int long foo = 0xFC4883E4;
    unsigned int long d1;
    unsigned int long d2;
    unsigned int long d3;
    unsigned int long d4;
    
    d1 = foo & 0xFF000000;
    d1 = d1 >> 24;
    d2 = foo & 0x00FF0000;
    d2 = d2 >> 16;
    d3 = foo & 0x0000FF00;
    d3 = d3 >> 8;
    d4 = foo & 0x000000FF;
    d4 = d4 >> 0;

    int arr[4] = {d1, d2, d3, d4};
    cout << hex << arr[0] << endl;
    cout << hex << arr[1] << endl;
    cout << hex << arr[2] << endl;
    cout << hex << arr[3] << endl;
    return 0;
}
#

this should work kekw

#

now gimme my cookie

remote echo
steady anchor
remote echo
#

And even if he wasn't asking, i would like to know

steady anchor
#

but why would use sth like hex as string

#

is there a thing called string to ascii kekw

remote echo
#

suppose u get a string as "fc4883e4" then how would u conver it ?

#

In python, i might use a loop

#

To get [n:n*2] element

#

And then int('element' , 16)

#

No idea about cpp lol

steady anchor
#

there is a manual way but i would not look nice kekw

#

wanna see my weird programming skills

remote echo
#

Ping me after you figure out ur cpp-fu lol @steady anchor

steady anchor
snow smelt
#

@steady anchor this is not indeed the right solution as you define unsigned int long foo = 0xFC4883E4;

The challenge is that it has to be string of any length containing valid hex system characters (e.g it could be std::string s = "fcab27bcd80e1ab25ced1683fffce3ed"

This string's length is 32, meaning that we need to end up to some byte array ba[] = { 0xfc, 0xab, ..., 0xed }
an array with size = 16

steady anchor
#

:rip:

#

why is this string so long

#

i thought it would be pointer

remote echo
#

I told ya @steady anchor

steady anchor
#

let me see what can i do

remote echo
#

@snow smelt is it being cpp mandatory?

steady anchor
#

i know there is easy way

steady anchor
#

you wanna do it in python?

remote echo
#

Not kidding lol, i don't know cpp

#

That's why i was asking

steady anchor
#

cpp is c

#

both of them should work

remote echo
#

So we can use stoi()

steady anchor
#

yeah

#

it is backward compatible

#

use can use c libraries

brazen eagle
#

stoi doesn't work on hex AFAIK

#

strike that it does

#

stoi won't give the arbitrary length byte array though

remote echo
#

I tried to write something in C, but in the end, I could not lol

brazen eagle
#

haha

#

I'll have to give it a go then

remote echo
#

Sure

#

I don't have experience working with strings in C

brazen eagle
#

haven't done much C in forever

remote echo
#

Use cpp then haha

brazen eagle
#

C/CPP

remote echo
#

Now i am getting very eager for answers

#
string = "fcab27bcd80e1ab25ced1683fffce3ed"
array = []

for i in range(0,len(string)//2):
    hex_value = string[i*2:(i+1)*2]
    array.append(hex(int(hex_value, 16)))

print(array)
#

here is python code

#

no one asked for lol

#

['0xfc', '0xab', '0x27', '0xbc', '0xd8', '0xe', '0x1a', '0xb2', '0x5c', '0xed', '0x16', '0x83', '0xff', '0xfc', '0xe3', '0xed']

#

^^output

brazen eagle
#

hehe

remote echo
#

just to satisfy my bursting head lol

snow smelt
#

@remote echo yeah that py code will work just fine! cpp time now πŸ˜„

brazen eagle
#

do they want the byte array as a return?

remote echo
#

I am having headache out of it lol

eager sail
#

do i need to learn programming for cybersec?

brazen eagle
steady anchor
#

there are no strings in cpp there are character arrays kekw @remote echo

brazen eagle
#

there is std::string

remote echo
#

Yes

#

I read today

steady anchor
remote echo
#

There is string

steady anchor
#

it is all character arrays

snow smelt
#

also, consider the null terminator of strings πŸ’©

#

it's a bit challenging

steady anchor
#

challenge not accepted

#

i am going to sleep

snow smelt
brazen eagle
#

that should be taken care of already

remote echo
#

Today i was going to start learning cpp lol

#

not it feels like hard af XD

#

isn't there a fun way learning it

brazen eagle
#

ah, I see

#

ha

remote echo
#
#include <stdio.h>
#include <stdint.h> 
#include <string.h>

int main ()
{
    char *hexstring = "fcab27bcd80e1ab25ced1683fffce3ed";
    int i;
    unsigned int bytearray[16];
    uint8_t str_len = strlen(hexstring);

    for (i = 0; i < (str_len / 2); i++) {
        sscanf(hexstring + 2*i, "%02x", &bytearray[i]);
        printf("bytearray %d: %02x\n", i, bytearray[i]);
    }

    return 0;
}
#

@snow smelt check this

brazen eagle
#

easy way to overflow the buffer there

remote echo
#

i didn't code it btw

#

XD

remote echo
brazen eagle
#

I'm having issues with the byte array

remote echo
#

@brazen eagle u said about buffer, but keeping it 16 is fine right?

#

i mean, what is vulnerable or bad

brazen eagle
#

it's the fixed length

remote echo
#

can u elaborate plz

#

i would like to know