#programming
1 messages Β· Page 20 of 1
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
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
I mean if you have a 50 kHz cpu and 16K memory then by all means optimize
not saying you shouldn't optimise code, but you shouldn't blindly 'optimise' code that may or may not even be the problem
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
yeah
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
why would you do that when you can use rm?
rm -rf /home/name/Downloads/*
^
I want to write my own programs
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 :-(
I think we did like ((x<<1)+2)>>1
I mean in JavaScript you'd do npm install isOdd
That was... the whole point
Coding test?
I have a great write-up on a problem involving bitwise operators on my binarysearch account
Oh I see
You can try to do it by overflowing the buffer...
Or underflowing those are fun too
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
I'm following this guide :
https://www.smeegesec.com/2017/03/captive-portal-wifi-phishing-with.html?m=1
Any idea how to log them ?
but there's a php script there @brazen flax
I tried the one given which saves the credentials, but it doesn't seem to work
did you have stored.txt in the directory?
Yes. I have tried :
-> creating the file
-> not creating the file
-> change perms
-> other fixes
None helped
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?
@onyx merlin this is my wacky bitwise operator writeup https://binarysearch.com/problems/Check-Power-of-Two/editorials/3057426
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
It wouldn't let me look so ok
bee you're mad
I probably can't do that today but I was specifically studying bitwise operators when I wrote that π€£
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
I'll have a look at this.
@brazen flax I'd check to see if anything is even being put in the file as well
im starting to learn javascript, i might learn more tonight.
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?
no redirects. the get request for the next request is in the response of the current request
in plaintext?
yes
might as well use netcat then...
im really bad to hack but can this server help me get bedder
@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
Easier to change for people viewing the script.
I just usually never had separated like that and was wondering
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.
I have had a few scripts in the past where I could have done something similar, learn something new everyday on THM
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
Anyone have any recommendations on where to learn c++ practically?
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
Why don't you want to reveal your IP? @lilac holly
someone people told me python is not the best for this tho
?
i heard free vpns sell ur data, paid ones are paid
You don't need a VPN usually.
They are probably correct. But also don't roll your own crypto
As for proxy settings, they should be documented
ok
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
of course it's something you could do if you keep practicing!
just like everything
cause it looks very hard
Programming and hacking are somewhat related, but not the same.
I wouldn't say it's easy, but it's managable
What do you want to create?
like what is something u guys create?
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
ok
I just use RustScan...
but I should go a bit further and automate the scripty bits
RustScan is good but it's way more satisfying creating your own π
sure
Imo, unless it can be improved upon its a waste of time and energy.
Also depends on what task youβre trying to complete.
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?
Are you talking about understanding algorithm complexity?
Any Archlab users here ?
Depends, its great practice π€·ββοΈ
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.
Have you tried coding game ? Pretty cool website to train algo π
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
>>> 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
Care to explain?
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
I swear "it's just abuse of mathematics" is your MO at this point
I prefer the 'goes to' operator
Slides to.
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
is there a python module that reads the text content of an image
pytesseract - a wrapper for Tesseract OCR
major way is Tesseract + Python
ok thank you
how do i add items to a existing dictionary
in python?
you mean copy files?
from shutil import copyfile
Who can recommend me a python resource ?
For what?
Shameless self plug but I write about Python here https://skerritt.blog/tags/python/ that might help :)))
Huh?
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
lmao mathjax rendering messed it up, it's supposed to be the set of 1 is not in the set of 1,2,3
ohh ok
sorry JavaScript libraries always break, I'll fix when I get home hahaha
use a bash script?
learning bash and writing the script will probably take you less time than doing it in Python
Thank you for the insight!!
hey, Algorithms are something you have to create but if you want to learn some standard ones you can find em literally anywhere on the internet. If you want to develop your algorithm dev skills then you gotta practise more problems
Anyone understand MIPS pretty well, getting into learning assembly and need some help!
How Linus Torvalds likes to remove items from linked lists, doesn't involve the typical if special case for the start node
https://github.com/mkirchner/linked-list-good-taste
anyone good with c++ in visual studio code?
Ask what's the question
Whats the question?
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
do you know how to fix it?
its not compiling right?
its underlined
Dope, there are many solutions given out. Try em, if nothing works out ask here someone might help.
But research first. π
well, for MIPS and assembly Derek Banas YT video provides pretty good understanding.
and check this book (8th Edition) Barry B. Brey-The Intel Microprocessors-Prentice Hall (2008)
@remote badge Thank you!
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.
@glass grove Both those languages will have implementations of a bunch of symmetrical encryption algorithms -- those will be compatible with each other
So yes
ive been googling around and re-discovered aes. but im super confused how i can get it working on both languages together...
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
mhm
No idea if those are any good, but first result on Google
thanks, ive looked at those already, but ill reread
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
im dont think ill be reinventing the wheel haha. im just having some trouble understanding aes
plaintext + key goes in, magic happens, ciphertext comes out
yeh, i thought it was that easy
how naive i was π
theres like different modes and initialization vectors ugh
ah
don't use ECB mode
that's crackable if you know some plaintext
an IV is generally a nonce
mhm
alri
The SubtleCrypto interface of the Web Crypto API provides a number of low-level cryptographic functions. Access to the features ofΒ SubtleCryptoΒ is obtained through the subtle property of the Crypto object you get from Window.crypto.
might help for the JS side
https://pypi.org/project/pycrypto/ might be helpful for the python side
pycrypto is outdated, I believe
ah
pycryptodome is the replacement iirc?
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
alright thanks guys!
pycryptodome recommends MODE_EAX. would u agree
@tulip sail @brazen eagle i think i got it, thanks for the help!
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
Did you try it on Linux?
I don't see any errors
nahh im running it on windows
I might honestly just do my competitive programming stuff on my Vms
@exotic skiff providing the compilation error would help in deducing the problem, visual studio can definitely be tricky for beginners
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
@outer jewel oh good eye, another easy solution could be std::vector
underlining is likely cause n hasn't been given an explicit value yet (int n = x, etc)
does anyone know a good tutorial for rust
its just the basics
You asked for a tutorial π€·ββοΈ
βοΈ
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.
Hugo on CF Pages is 2 years out of date lol
I don't think there is
Has anyone here developed a CyberChef module before? Iβve never developed in node.js and some mentorship would be hugely appreciated ππΌ
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.
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.
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).
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.
anyone here use MacVim can I ask some questions
Whatβs your questions?
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
It looks good
π«
Sorry I forgot to respond hah. I have no clue, I don't know anyone who does or use that colour scheme.
thanks you i'll change to another one
My only question is, why are you on light theme
My problem with that is odd kerning.
I just bored at dark theme and want to change a little bit
I change them regularly
God you hate yourself dont you.
Oh gods light mode is so bright :(
does anyone know the name for How is data stored into the stack in x86 architecture?
@exotic skiff you mean stack register
Yes, but that's A) a Google question and B) looks suspiciously like homework
What on Earth are you talking about?
about the theme color of MacVim
π«
HAHAHA NO, I WAS DOING THIS ONLINE TEST AND IT SAID THAT I GOT ONE WRONG BUT IT DIDNT TELL ME WHICH ONE
it was this multiple choice thing
I asked cause that was the only question I wasnt sure of
its just for fun hah
haha*
ok then
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?
God don't do that in python
Python is crazy overkill
Just add it as a bash alias or something
Ok bash it is lol
Yeah no don't do it in python
#! /bin/bash/roki xD
add something likealias thmvpn='sudo openvpn /home/< USER >/Downloads/rokie.ovpn to ~/.bashrc and then do source .bashrc then everytime you run thmvpn you will be prompted with your password to run the ovpn command π
freaking dope! thanks man xD
Let's see if i get this right
You should see in bashrc where the alias are roughly and just add your own in π
You could also set it up to do Muir's VPN script
so i would need to nano ~/bashrc to do this right?
Yup
Yea
I'd do it with this myself:
alias thmvpn="tmux new -s THMVPN \"sudo openvpn ~/Downloads/MuirlandOracle-THM.ovpn \""
Depends if you use tmux I guess
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
I ran the command you gave @tulip sail and it seems to exit me out
Exit you out?
did you change the filename
Funnily enough, you don't have a file called ~/Downloads/MuirlandOracle-THM.ovpn
That bit needs changed
i am an idiot
Nah -- happens to everyone π
Still having the same problem lol
it worked!!!
this is utterly amazing !
I feel like god
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
wait is this something we should help with? seems like a homework
I don't think it affects that much. It's just 1 point ;-;
Ah we usually donβt help when itβs point based, you should probably ask your teacher @lilac holly
Giving a nudge is fine but when youβre being graded on your knowledge it is unfair.
didn't get auto modded what the heck?
Could you at-least tell me where I went wrong?
Check announcements π
Have you googled at all?
yep, I tried all sorts of code. nothing worked.
Even in programming servers. people choose not to answer my question lol
Yeah, because homework questions
not even this?
let me see a little wait
Thanks
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
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.
u don't have to change the html part
just use a specific selector
or add a class
ezpz
Wdym?
@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>
So, it will boil down to finding a way to auto-detect audio files in a user's file directory?
cool np
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
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
^
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 ?
I'm guessing it's a matter of a command to prompt open the file directory to choose anything in a .mp3 format.
So convert it from .sh to .mp3?
Excuse me, what?
Stick it in your bash aliases
No . After it.
Your filename looks wrong. That's what I'm saying.
You have a random .
Stop using control z
I switched it from aliases to thmvpn
It does not close the program. It backgrounds it.
okay /:
There was a reason the file was called that.
because it's my actual rokie.ovpn file right ?
I'm so confused
brb
Eh I'm out
Simple instructions were given
just ask your question
What does this regex do?
const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
good tool I use to understand regexes
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?
@wispy tusk Do I want to know why?
I love making challenging tools which will help me learn a lot along the way.
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
Ooh...π π okay..no issuesπ
Can Making it open-source for educational purpose be safe?
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
Ahhh... Alright.
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
aliasing?
My program relies on Hashcat, how can I get Hashcat in CI? How can I test the Hashcat module works in CI? π
I would create a custom docker image that has all the tools you need to build and test your project. In your CI step you can just pull this image and start building/testing, without having to install tooling first, which can save quit a bit of time
typically each step in a CI/CD pipeline runs in it a separate container, with outputs at each stage injected into a shared storage volume or into the next image build
yess there's defo a CUDA & OpenCL image(s) (:
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
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
I think the debugger only shows the value at *test, that is test[0]
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
did you read the doc?
there's an example config: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#example
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
Iβm unsure what you mean?
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
You want it to continually count up while the program is running?
exactly,
but it has to keep printing the time elapsed since the program / func is running
Give me a moment to clean up
kk
Something like this
Im kinda there
nvm.
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
Okay, I am back at my PC.
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
Are you entirely set on threading?
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
@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())
probably an existing lib
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.
Ah ok
I used tdqm to make a progress bar thingy recently but you want a spinner, basically ye?
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 π
ooh this is pretty neat https://github.com/pavdmyt/yaspin
I try to stay with base libraries if I can.
This is quite good, its what ciphey uses
You could use a for loop with "\r"
\r doesn't work on Windows, unless they fixed that
It works with powershell
Not cmd
@brazen eagle
(With the new windows terminal)
I use it all the time haha
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
can't be as pretty as the light mode on https://0day.exposed/reverseshell/
Hey, can I get some help real quick?
I'm trying out a problem, but I feel like I'm doing something wrong.
didn't do the animation, but I'm sure it can be arranged
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 ...
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+"
This is python, correct?
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 : ")
Yes
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()
βπ
@balmy flint So you want two lists, one of which is immutable and the other that is modified?
Yes both are same and if one is modified it won't affect the other
Is the program small enough to be shared here?
To me ?
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
Actually this isn't working for me sadly
What version of Python?
Well it's a website for coding ...it says 3.x
would need a deep copy, ye?
deepcopy ?
Mhm
hmm, I really don't know how python's object model works
@rocky latch https://www.freecodecamp.org/ is a good place to start programming.
is it references everywhere?
This is a simple as I can get it in python 3.9.1:
A = [1,2,3]
B = [item for item in A]
for ints then sure, but for objects they'd be pointing to the same object no?
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]
B = list(A) is easy to read (maybe)
Assignment statements in Python do not copy objects, they create bindings between a target and an object.
from the python doc
Well if I doing with copy or deepcopy both the lists get completely immutable in my case
How could I forget about list
you need coffeeβ
yeah but does list do a deep copy or a shallow copy?
deep copy..... iirc
Would I rather post a code of mine...and the output ..!
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]
Good idea, brb.
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?
If you are storing values in a list, I am sure they are references
Is b= list (a) is different from b=a
pass by ref?
Possibly
that's generally for functions
B = list(A) calls a constructor for list using A as an initialization param
I assume
I am pretty sure this is being taken out of scope
maybe
Instead of storing a reference of the list, you are creating a new object.
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
I'm confused with this
I am having list of strings
primitives are pretty much immutable
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.
it's a super common error
Objects work differently, luckily when embedded objects in lists I don't usually create list copies.
because pointers are hard
@true pumice if you do a deepcopy, then they'll be independent
Eh, no need
I found a workaround a little while back for my programming assignment π
oh dear
What's up π
(I re-wrote the program so I didn't have to use them because they're icky and I hate pass by reference)
pass by reference is useful
I'm modifying the contents of lists by assigning to some string...so will it hold for deepcopy?
It is above my pay grade.
but also tricksy tricksy
naw should be fine for strings
might want to test that though
Oh no its not for me hereπ
thanks a lot
Okay, it is coffee time
tea time!
Oops I made a mistake.... it's working now....
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
@lilac holly
alias thmvpn="tmux new -s THMVPN \"sudo openvpn ~/Downloads/MuirlandOracle-THM.ovpn \""
Hey thank you !! π

Like pythons \n
yeah it is for character escaping in bash
Noiiiiiice
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.
Woah. You are like mind reader. I too was wondering why it only had double quotes at the end and not the beginning
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.
And tmux new -s stands for new session correct?
got it thanks
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)
oh okay thanks
tysm
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)
This might be a dumb question but I really want to know
Does importing many modules increase the size of a script
Ok does it make the script run slow?
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.
Ok thanks a lot
Generally we want to try to import exactly what we need
Hi, apparently, Kali can't down the eth0 interface (not allowed to)
How can I change that ?
@ me when answering, ty
That doesn't seem like a programming question?
Someone good in C language and reverse engineering?
Just ask your question
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?
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
What's the goal of the challenge anyway?
it'll output gibberish if the key is invalid
Because just use the movfuscator.
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
Did you mention this was an exploit?
yes
and hack my own roblox game
π
Ohh no
We do not do that here.
In order to make Roblox cheats you need permission from Roblox
Do not think you are reading what I am saying.
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.
Does not matter.
pls bro help me
They do not own Roblox.
-warn @shrewd raft Please stop discussing illegal activities here, Jabba already stated that we don't do that here
β Warned ManiustBCT#3877
Can I dm you?
Hello guys, are there any C programmers here?
What about?
I want send the program, so you can tell me how I can change it.
Or a screenshot
Sorry not too available at the moment, post your problem here and maybe we can crowdsource it
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?
I think there are already tools for that but if you're interested on making you're own I dont think the language would change much since its such a simple app
Oh, I didn't know that. I'll look into it but will probably do it myself anyway. Thanks!
http://www.loltracker.gg/app/?isDemo=true here is something I found
I just found that as well :D
i wouldn't worry about resource usage at all, now things may get complicated depending on if custom UI/HUDs are against the Tos/EULA for League of legends, I have no clue on that end
There are plenty of them on the Internet and used by popular streamers and no one's complaining, so my guess would be no.
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
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!
My recommendation is to NOT test it on your main account, seeing as hooking things can be picked up by anticheats
Good shout, thanks!
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?
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
Yeah the single instruction part is what makes it tough here
http://altmer.arts-union.ru/3DO/docs/DevDocs/tktfldr/acbfldr/2acbb.html This looks like you're stuck at 2 instructions?
Maybe talk to your teacher and say "I think it's impossible because of these well thought out concepts, do you have any advice?"
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!
I'd say it's not a good solution for anything that isn't a power of 2
Maybe it's worth discussing the limitations in whatever you're submitting?
Probably, yeah
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 π³
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
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
I know that, but argc[0] is the name of the program, which I donβt need
Sorry, I meant argv
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
Isn't fetch for http requests? So, couldn't you just pass it a string or whatever?
if i pass it a string then it for some reason grabs the index.html
fetch('../blogs/Test.md')
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.
Not as such... The equivalent to a promise the 'future'. You'll see that in C++ concurrency/asio libraries as well as in C#.
i have them in the public directory so they are being hosted
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
You donβt have to but it could be useful
I think to learn at a normal level
sure just learning some can be helpful
@tulip ibex Lets try not to make fun of anyone.
who have a simple code to save file of a text
i am making my notepad
no save as
only save as .txt
What programming language?
C#
I have a question what is a good programming language if I want to work with Networks?
Python can be good.
!p sky playboi carti
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;
}
} `
@shrewd raft
> who have a simple code to save file of a text
System.IO.File.WriteAllText(content, $"{name}.txt")?
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
why is this error coming
most likely a permissions error, see the following https://stackoverflow.com/questions/41518905/pyaudio-oserror-errno-9999-unanticipated-host-error
Thank you
this solved the problem
you can use code blocks with three `
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?
can you teach me write those scripts π¦
joy21, have you tried printing out the whole response to see if the desired response is there?
( @cunning zephyr )
Yes, I printed r.text and it returned the page but when tried to see the cookies using r.cookies it was empty like {}. I think the cookies aren't supplied to the webpage. Can't figure out why.
π―
Is your payload 100% correct?
yes. it works in burp.
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 ?
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 )
well but if I use os.system('clear/cls') it will remove the "crakcing hash" part but I need to remove only the hash it self (sorry for bad english)
use the end='\r' method. It resets the cursor to the beginning of the line. You will have to rewrite the CRAC.....HASH part, but is that really a problem?
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
btw the 20 in the addstr is the character number where it puts the cursor on the line
Anyone here knows pascal? I need help
-warn @dusty ore Please do not use homophobic language
β Warned JohnLmao#3515
Oh im sorry
Pascal is a blast from the past
I wasn't aware people still used that language
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?
RE module?
yes
Oh Regex
Its something like this :
title = "<title>"
stringwewant = re.findall(title, r.content,flags=re.MULTILINE)
print("############## This for the Request" + str(x) + " ##############")
print(stringwewant)
I'm slightly confused on what you are asking.
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
like in bash it could be : ```
curl http://url/endpoint/ | grep <title>
nopee
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)
Ohh thank you, i will take a look at at the beautifullsoup library and use this
Mhm, no problem.
Thanks it worked 
Where do i learn about haking
Pascal, Cobol and Fortran are still used in specific industries in the US - the state of New Jersey, for example, was in desperate need of cobol programmers last year because they hadn't refreshed their unemployment computer system in 30+ years
I know, I'm just surprised
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
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
so...like python π
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
...
anyone able to help a little with C
I'm trying to use the ioctl function, but to no avail
post your code and error please
you mind if I pm? @magic falcon
just post here
#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
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?
Look at the syntax of chmod and compare it to what you're doing
https://linux.die.net/man/1/chmod Particularly the first few lines showing how you use it
chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions ...
oh i just figured it out π thank you
This looks like a mis-use of IOCTL to me. Someone with more understanding of C device drivers should weigh in too, but IOCTL is intended to manage connected devices; there are other device config flags that may need to be set to manipulate a fd with that lib.
ahh, there's a very high chance of that π
I mainly scraped that script from https://stackoverflow.com/questions/32465756/setting-immutable-flag-using-ioctl-in-c
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?
Why would you want to do that?
i made a script that opens a new window and plays never gonna give you up every 3 mins
That'd be a massive security hole in Windows, so there's a reason it's patched
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?
Yes but the user would need to install it on their computer first.
does anyone know how to save a c# fourms .net file?
like on your windows desktop
or something
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)
http://www.cplusplus.com/reference/cstdlib/strtoul/ might be of some use?
or some similar function
or strtol
my idea was to take the hex value mask it and then use right shift operator and store it in an array
I see where this going π
#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 
now gimme my cookie
But i think he was asking it was string "fc4883e4" not unsigned int

And even if he wasn't asking, i would like to know
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
there is a manual way but i would not look nice 
wanna see my weird programming skills
Ping me after you figure out ur cpp-fu lol @steady anchor

@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
I told ya @steady anchor
@snow smelt is it being cpp mandatory?
i know there is easy way

you wanna do it in python?
So we can use stoi()
stoi doesn't work on hex AFAIK
strike that it does
stoi won't give the arbitrary length byte array though
I tried to write something in C, but in the end, I could not lol
haven't done much C in forever
Use cpp then haha
C/CPP
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
hehe
just to satisfy my bursting head lol
@remote echo yeah that py code will work just fine! cpp time now π
do they want the byte array as a return?
I am having headache out of it lol
do i need to learn programming for cybersec?
if the byte array the return or the print to screen?
there are no strings in cpp there are character arrays
@remote echo
there is std::string
No, but it will be beneficial if u do
Yes
I read today
it used power of library and hard work of some developer
There is string

that should be taken care of already
Today i was going to start learning cpp lol
not it feels like hard af XD
isn't there a fun way learning it
#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
easy way to overflow the buffer there
i didn't code it btw
XD
Yup
I'm having issues with the byte array
@brazen eagle u said about buffer, but keeping it 16 is fine right?
i mean, what is vulnerable or bad
it's the fixed length

