#programming

1 messages · Page 21 of 1

remote echo
#

and if possible, a better implimentation

brazen eagle
#

I dunno about better though but that implementation doesn't actually return the byte array

#

I have this so far but it doesn't seem to work outside the function:

#
#include <iostream>
#include <string>
#include <vector>

void debugVector(std::vector<unsigned char> bytes) {
     for (std::vector<unsigned char>::const_iterator i = bytes.begin(); i != bytes.end(); ++i)
        std::cout << std::hex << (0xff & *i) << ' ';
    std::cout << std::endl;
}

void printBytes(const unsigned char *bytes, unsigned int length) {
    const unsigned char *end = bytes + length;

    std::cout << "As char * in fn: " << bytes << std::endl;

    for(unsigned char *ptr = (unsigned char *)bytes; ptr < end; ptr++){
        std::cout << "0x" << std::hex << (0xff & *ptr) << " ";
    }
}

const unsigned char *str2hex(const std::string input) {
    
    std::vector<unsigned char> bytes;

    for(int i = 0; i < input.length(); i += 2) {
        std::string subst = input.substr(i, 2);
        char byte = std::stoi(subst, nullptr, 16);
        std::cout << "Found byte: " << subst << ":: Converted to: " << std::hex << (0xff & byte) << std::endl;
        bytes.push_back(byte);
    }

    debugVector(bytes);
    const unsigned char *byteArr = &bytes[0];
    std::cout << "As char *: " << byteArr << std::endl;
    return byteArr;
}

int main(int argc, char const *argv[])
{
    // Check Args
    if( argc < 1) {
        std::cout << "Please Input a string" << std::endl;
        return -1;
    }

    std::string input = std::string(argv[1]);
    const int length = input.length();

    // add padding 0 if length is odd
    if(length & 1) {
        input.insert(0, 1, '0');
    }

    int numBytes = input.length() / 2;
    
    const unsigned char *bytes = str2hex(input);
    printBytes(bytes, numBytes);

    return 0;
}
#

there's a bit of debug code sorry

#
❯ ./str2hex 41424344
Found byte: 41:: Converted to: 41
Found byte: 42:: Converted to: 42
Found byte: 43:: Converted to: 43
Found byte: 44:: Converted to: 44
41 42 43 44 
As char *: ABCD
As char * in fn: �rX��U
0xe0 0x72 0x58 0xa6
#

and this is the problem @snow smelt was alluding to:

❯ ./str2hex 414243440046
Found byte: 41:: Converted to: 41
Found byte: 42:: Converted to: 42
Found byte: 43:: Converted to: 43
Found byte: 44:: Converted to: 44
Found byte: 00:: Converted to: 0
Found byte: 46:: Converted to: 46
41 42 43 44 0 46 
As char *: ABCD
As char * in fn: ����uU
0xc0 0xf2 0xd4 0xf5 0x75 0x55
#

bit of factoring to do as well

remote echo
#

This works btw

#

If u don't want to print don't print, but it's making a bytearray

mighty siren
#

this looks like alien language to me

brazen eagle
#

I suppose

#

I'll try with ints

#

of course it fails

#

I'm wondering why my char * is getting mangled

#

oh I'm dumb

#

I need to allocate on the heap

#

there we go

#
❯ ./str2hex 414243440046
Found byte: 41:: Converted to: 41
Found byte: 42:: Converted to: 42
Found byte: 43:: Converted to: 43
Found byte: 44:: Converted to: 44
Found byte: 00:: Converted to: 00
Found byte: 46:: Converted to: 46
41 42 43 44 0 46 
As char *: ABCD
As char * in fn: ABCD
0x41 0x42 0x43 0x44 0x00 0x46
#

might be a bit leaky though

#

I still don't like this though

#
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>

void printBytes(const unsigned char *bytes, unsigned int length) {
    const unsigned char *end = bytes + length;

    std::cout << "As char * in fn: " << bytes << std::endl;

    for(unsigned char *ptr = (unsigned char *)bytes; ptr < end; ptr++){
        std::cout << "0x" << std::setw(2) << std::setfill('0') << std::hex << (0xff & *ptr) << " ";
    }
}

const unsigned char *str2hex(const std::string input, std::vector<unsigned char> *&bytes) {
    for(int i = 0; i < input.length(); i += 2) {
        std::string subst = input.substr(i, 2);
        unsigned char byte = std::stoi(subst, nullptr, 16);
        (*bytes).push_back(byte);
    }

    const unsigned char *byteArr = &(*bytes)[0];
    return byteArr;
}

int main(int argc, char const *argv[])
{
    // Check Args
    if( argc < 1) {
        std::cout << "Please Input a string" << std::endl;
        return -1;
    }

    std::string input = std::string(argv[1]);
    const int length = input.length();

    // add padding 0 if length is odd
    if(length & 1) {
        input.insert(0, 1, '0');
    }

    int numBytes = input.length() / 2;
    
    std::vector<unsigned char> *byteVec = new std::vector<unsigned char>();
    const unsigned char *bytes = str2hex(input, byteVec);
    printBytes(bytes, numBytes);

    delete byteVec;

    return 0;
}
#

should just use the darned vector though tbh

#
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>

void printBytes(const std::vector<unsigned char> *bytes) {
     for (std::vector<unsigned char>::const_iterator i = (*bytes).begin(); i != (*bytes).end(); ++i)
        std::cout << "0x" << std::setw(2) << std::setfill('0') << std::hex << (0xff & *i) << ' ';
    std::cout << std::endl;
}

const std::vector<unsigned char> *str2hex(const std::string input) {
    
    std::vector<unsigned char> *bytes = new std::vector<unsigned char>();

    for(int i = 0; i < input.length(); i += 2) {
        std::string subst = input.substr(i, 2);
        unsigned char byte = std::stoi(subst, nullptr, 16);
        (*bytes).push_back(byte);
    }
    return bytes;
}

int main(int argc, char const *argv[])
{
    // Check Args
    if( argc < 1) {
        std::cout << "Please Input a string" << std::endl;
        return -1;
    }

    std::string input = std::string(argv[1]);
    const int length = input.length();

    // add padding 0 if length is odd
    if(length & 1) {
        input.insert(0, 1, '0');
    }

    const std::vector<unsigned char> *bytes = str2hex(input);
    printBytes(bytes);

    delete bytes;

    return 0;
}
#

there

#

this should work for arbitrary-length strings

#

probably needs a bit more input validation though

remote echo
#

@brazen eagle why it looks like language from other planets lol

brazen eagle
#

because it's C++

#

(bad C++ as well)

remote echo
#

U know some interesting learning resources for cpp?

snow smelt
#

alright saw you have some solutions on that, lets check these

remote echo
#

Learncpp or cplusplus looks very dry

snow smelt
#

best way of learning cpp: watch a tutorial onto something, make challenges on your own based on that tuto, try to solve them, die browsing stackoverflow, profit

remote echo
#

For python, CTFs got my back

#

And a lot of projects

#

But for cpp, i can't find much tbh

magic falcon
solar hull
#

with c++ (or Java tbh), avoid looking at legacy code. The language has turned a lot better in the last few (ten is a few, right?) years.

magic falcon
#

Most learning for C++ is pain and suffering, you'll be better off using an IDE like CLion or Xcode.

brazen eagle
#

I need to figure out how those smart pointers work

magic falcon
#

and just writing a bunch of code for trivial and less trivial projects

#

smart pointers are radical

#

totally change the way you think about how RAII

brazen eagle
#

they were introduced just after I stopped using C++

solar hull
#

I passionately hate the way inheritance works in C++.

brazen eagle
#

inheritence is pretty dumb everywhere

magic falcon
#

at least polymorphism is flexible enough in C++ to be usable

brazen eagle
#

tbf if I were doing this properly in C++ it'd be in a class already

magic falcon
#

the inheritance in Java is way less usable

#

not necessarily

brazen eagle
#

composition > inheritence

remote echo
magic falcon
#

proper classing in C++ should be done with the mindset of where the manipulation is taking place

remote echo
#

Just for reference

brazen eagle
#

I was on C++ Reference all the time

magic falcon
#

oh, its definitely for learning. Between the documentation and examples, it's really ehlpful

solar hull
brazen eagle
#

haha

magic falcon
#

back to OOP: I use an object to maintain state transformations, but not for interactions between objects

brazen eagle
#

oh gods those always threw me for a loop in school

magic falcon
solar hull
magic falcon
#

virtual or pure virtual?

#

variadic metaprogramming is template programming

solar hull
#

Yeah. I just didn't want to acknowledge seeing that mentioned 😄

magic falcon
#

haha

solar hull
#

I can't really remember the difference between virtuals and pure virtuals. I'm just an occasional recreational user.

#

Of C++, that is 🙂

magic falcon
#

pure virtual is a virtual function that is undefined in the base class, and only has a signature

solar hull
#

makes sense. (that's a first for C++)

magic falcon
#

so derived classes must implement it

#

c++ makes a lot of sense, don't blame the language because it gets misused

solar hull
#

true.

snow smelt
#

@brazen eagle @remote echo @steady anchor

#include <string>
#include <sstream>

using namespace std;
// i luv bad practises

int main() {

    string s = "fcab27bcd80e1ab25ced1683fffce3ed";
    const int sLen = (sizeof(s) / sizeof(char)) - sizeof(unsigned long long);
    char arr[sLen-1];

    string fin;
    for (int i = 0; i < s.length(); i += 1) {
        string tmp;
        tmp.push_back(s[i]);
        tmp.push_back(s[i + 1]);

        stringstream str;
        str << tmp;
        int val;
        str >> std::hex >> val;
        fin.push_back(val);
    }

    strcpy(arr, fin.c_str());

    return 0;
}
#

The solution i came up with3

brazen eagle
#

that'll work too

snow smelt
#

Preprocessor definition _CRT_SECURE_NO_WARNINGS needed if you're gonna compile that through vs

brazen eagle
#

I got no warnings

snow smelt
#

i got one cuz of strcpy

brazen eagle
#

but I was wondering if inputstream would work

#

strncpy?

snow smelt
#

strcpy(arr, fin.c_str());
last line of the code

brazen eagle
#

yeah, use strncpy

snow smelt
#

oh okay! thanks!

brazen eagle
#

it basically copies n bytes

#

wonder if c_str(); handles null bytes properly though

#

or if it will consider it a terminator

steady anchor
#

110 msgs wow

brazen eagle
#

eh?

magic falcon
#

c_str dumps the current string object in to a c string

#

which is nullterminated

brazen eagle
#

yes

#

so if there's a 0x00 in the array

#

everything after is no longer interpreted

snow smelt
#

what i use if i want to push back a null byte (e.g when experimenting with shellcode strings)

#

i do that

#

"mystr" + std::string(3, '\0')

#

this will add 3 null bytes

#

for example

std::string payload = "\xfc\x48\x83\xe4\xf0\xe8\xcc" + std::string(3, '\0')

will result in a
\xfc\x48\x83\xe4\xf0\xe8\xcc\x00\x00\x00 string

#

pretty useful if you guys are looking for AV evasion, as the static analysis will immediately detect your payload byte array and mark it as malicious

#

tbh, i like more to play with strings rather than byte arrays as it makes it super easier for evasion, using libs like xorstr, base64 or any other form of encode / encryption
Do you agree or you take a different approach ?

remote echo
steady anchor
vernal vigil
#

Hi

steady anchor
#

but i did not used std::hex just hex cause of std

vernal vigil
#

Java sucks

#

Bye.

steady anchor
#

👀

#

anyway moving on

brazen eagle
#

that was C++

vernal vigil
#

I know what it was, i was stating the truth.

ocean tinsel
#

WHY IS C SO HARD????????????????????????

fallow glen
#

sorry you have a script for .vbs that opens a file, for example notebook.txt?

onyx merlin
#

@azure orchid Keep it safe for work.

azure orchid
#

dang aight

brazen eagle
#

C is only as hard as you let it be

steady anchor
#

wise words

pine jungle
#

Anyone good with python here?

onyx merlin
#

Just ask your question

pine jungle
#

I'm looking to automate my workflow using python, Is it possible to spawn a new terminal using python?

true pumice
#

Yup, I believe so

pine jungle
#

Could you point me in the right direction if you know, I am currently looking at the 'OS' and 'Subprocess' modules and struggling to find something

surreal bronze
#

Could you elaborate on "spawn a new terminal"

#

Like actually open a new terminal window?

#

@pine jungle

pine jungle
#

yes, I would like to open a new terminal window or tab and then execute commands on the new tab/window

true pumice
#

Not sure about executing commands, you can do that using subprocesses but I think it has to be run from the terminal

pine jungle
#

coolio

#

Thanks for the help @true pumice

surreal bronze
#

I presume your on Linux right? @pine jungle

pine jungle
#

Yes bud

surreal bronze
#

Would work?

#

Idk

#

I'm not on my computer atm

pine jungle
cursive orchid
#

anyone know of a site that takes some css, and minifies it in a sense that it takes elements/classes/ids with the same properties and combines them?

#

so if i gave it

.a {
  margin: 10px;
}
.b {
  margin: 10px;
}
#

it would return css .a, .b { margin: 10px; }

cursive orchid
#

ah nice ty

onyx merlin
#

pretty neat ngl

steady anchor
#

noice

cursive orchid
#

another css problemo

#

i have a navbar, links on the left, icons on the right

#

nvm

#

i did it

#

call me a genius

remote echo
#

import pty
pty.spawn("/bin/bash")

dreamy relic
#

Hi guys, i upgraded my kali using the apt dist-upgrage... Well a lot of python scripts are written with the version 2 of python, and most libraires/modules in my kali are used only by python3.

Well here are my questions:

-Is there a way to load modules on python2 ?
-Can i convert the python2 to python3 scripts ( i know some websites but not always working)?
-What kali version uses python2 instead of python 3 and, is it permitted in new oscp?

cursive orchid
# dreamy relic Hi guys, i upgraded my kali using the apt dist-upgrage... Well a lot of python s...
  1. if you're running with python3, then you can't import python3 modules; however there are packages that try and translate it: https://python-future.org/translation.html
  2. there are a couple ways, 2to3 should be installed on kali by default (might not be totally reliable): https://docs.python.org/3/library/2to3.html
  3. pretty sure all kali versions include both python2 and python3, and you can use either on oscp
amber dirge
#

I have a ruby script, it gives me binary output rathen than variable output

#

what is my mistake?

dusty ore
#

need a little bit of help

#

i wanna rename all of these files

#

and only keep the first 2 letters

#

without doing these manually

#

can someone help me do this?

#

ah i did it with a help of a stackoverflow's member

#
setlocal enabledelayedexpansion
for %%i in (*.wav) do (
  set "fname=%%~ni"
  ECHO ren "%%~fi" "!fname:~0,2!%%~xi"
  ren "%%~fi" "!fname:~0,2!%%~xi"
)
pause```
glass cape
#

Write a program to count the frequency of elements in a list of numbers.

#

this is what i tried its wrong but how to correct

#

it

sacred nimbus
#

So I understand that the input of the program will be a list of numbers like [1,5,6,6,2,2,2,2] and you have to output the frequency of each number like this: 1:1, 5:1, 6:2, 2:4?

glass cape
surreal bronze
#

@glass cape You want a list of numbers from the user

#

Then the user gives you another number and you want to check how many times that number appears in the list

#

Am I right?

sacred nimbus
# surreal bronze Am I right?

In that case the input would be:
List: [1,5,6,6,2,2,2,2]
Num: 6
And the output:
6:2 -> meaning the number 6 appeared on the list twice

#

Is that correct?

#

@glass cape

glass cape
#

offcourse

glass cape
surreal bronze
#

Rightio

#

@glass cape is this for homework?

glass cape
surreal bronze
#

ahh kk

glass cape
#

i rarely ask any homework question here

surreal bronze
#

What have you got so far?

glass cape
#

are you there

surreal bronze
#

yeye

#

Okay, firstly we need to get the list of numbers

#

So we can do this with:
li = list(input("Enter numbers --> "))

glass cape
#

??

surreal bronze
glass cape
# surreal bronze

yes as i said they are string but wait a min how did you split them without useng split function

surreal bronze
#

The list() func does this for you :)

sacred nimbus
#

list() does the conversion for you

surreal bronze
#

Okay, I need to brb - giving my mum a present

glass cape
sacred nimbus
#

@glass cape are you there?

glass cape
#

i am

sacred nimbus
#

good

#

that's the most basic version of your program

surreal bronze
#

okay back

sacred nimbus
#

you first ask the user for the list of number
Then iterate through that list to find out how many time each number occured
At the end you ask the user for the number they are interested in and print how many times did it occur

surreal bronze
#
li = list(input("Enter --> "))
num_to_find = input("Enter number")
count = 0 # We start at 0 as we presume it isnt in the list
for num in li: # For every item in the list we:
  if num == num_to_find: # Check if its the same number as num_to_find
      count += 1 # If it is, we add 1 to the count
print(count)
glass cape
surreal bronze
#

okay, so he's done it where he's getting every number

sacred nimbus
surreal bronze
#

and then storing it into a dictionary

#

though I feel that is a bit overkill for what he wants

glass cape
sacred nimbus
#

however this solution allows you to see how many times each number occurred

#

so go with @surreal bronze's solution for this particular example but keep in mind that you can solve it this way too

glass cape
#

actually both of yours solutions are helpful to me @surreal bronze and @sacred nimbus i can use both of them if the question focuses on my list chapter i can go with jays one and if it is of dictionary i can go with b4rtoo one thanks a lot for your help

surreal bronze
#

👍 👍

sacred nimbus
#

You're welcome!

violet cipher
#

Hi guys, I'm currently doing the Buffer Overflow Room, on task 8 I'm trying to pass as argument to the binary I'm exploiting the output of a python program, but I receive this error, does anyone have a hint to solve this issue?

carmine pagoda
#

does anyone have any experience with selenium?

#

given these elements is there a way to select the yellow elements iff they fall in a specific row/column?

#

they all have the a mutual class which is how i'm selecting them now, but i'm not sure how to filter them any further...

lilac holly
#

Hi

#

Is it possible to decode SHA512 using python

#

For example :
"45ca55ccaa72b98b86c697fdf73fd364d4815a586f76cd326f1785bb816ff7f1f88b46fb8448b19356ee788eb7d300b9392709a289428070b5810d9b5c2d440d" means "hi" when I pass it on to a decoder online. Is it possible to do the same in python.

true pumice
#

Google Crypto.Cipher module in python

lilac holly
#

k

#

thanks

surreal bronze
#

Just to let you know, your not actually cracking the hash, all the "online record" are just database which store many hashses and then cross reference your input hash)

surreal bronze
#

Glad you did 😄

opaque oyster
#

Hey, hi everyone I am trying a LFI and I would like to ask if it is possible here:<?php include("inc/$mail.page.php"); ?>

opaque oyster
spare forge
onyx merlin
#

I'd honestly swap the quotes around?

#

Single quotes for bash means don't interpret anything between them

spare forge
#

Indeed when I did the task I swapped the quotes, I tried and '\x41' is translated as 'A', so I guess that the part after -c is only interpreted by python?

glass cape
#

scl = dict()
i = 1
flag = 0
n = int(input("enter the number of entries"))
while i <=n:
Adm = input("enter the admission number ")
nm = input("enter the name of student")
section = input("enter the name of the section")
percentage = float(input("enter the percentage of the student "))
b = (nm,section,percentage)
scl[Adm] = b
i = i + 1
l = scl.keys()d

for i in l:
print("\nadmno ", i, " 😊
z = scl[i]
print("name\t", "class", "per")
for j in z:
print(j , end="\t")

#

what is the meaning of scl[Adm] = b

#

in this code

#

and i have no idea why that emoji is there i think its because of that : ) thing

true pumice
#

Could you use code blocks please:)

#

So, at the top scl is defined as a dictionary.
From there, there are a few inputs and processes performed and that then comes down to b which seems to be a tuple.
b is then stored inside the dictionary scl with the key Adm.

Dictionaries work like this in python:

dictionary = {key: value}

If you create a dictionary and later want to store values in it, you need to store them in a key:value format.
See this example here:

dictionary = dict() # Create the dictionary 

key = "I am a key!"
value = "I am a value!"

dictionary[key] = value

When you print the dictionary, you will have: {'I am a key!': 'I am a value!'} as the output.
You can use this in various ways, such as:

# 1
dictionary["This is a key"] = "This is the value"

# 2
dictionary[variable] = "Insert a value here!"

# 3
dictionary["Key here"] = variable

You might want to refer to the documentation or google for more details @glass cape

surreal bronze
#

Oh btw you can also define a dict with:

#

dic = {}

#

Or

#

dict = {"key":" value","key":"value"}

ionic breach
#
dict = { 
    "key":"value",
    "key2":"value2"
}

this way as well

#

(just for elegance's sake haha)

surreal bronze
#

Yes thats the same but better formatted 🙂

glass cape
#

and also i thought blocks only works in py dis lol

#

i was wrong

glass cape
versed bronze
#

Hey. I'm currently doing the Codecademy python programming courses - Currently on the "Student becomes the teacher" lesson Part 6. "Just Weight and See" (hoping someone has already done this 😄 ).

#

This was my original code. Which wasn't accepted:

#

def average(numbers):
total = sum(numbers)
total = float(total)
total = total / len(numbers)
return total

def get_average(student):
homework = total(student["homework"])
quizzes = total(student["quizzes"])
tests = total(student["tests"])

#

Tried to add a picture but it didn't allow me to copy and paste and screenshot... But anyways. I changed "total" to "average in the function get_average and it worked. My question is - why?

true pumice
#

There's a chance that the code used to validate your code looks for key-words.

brazen eagle
brazen eagle
#

but also average is defined but never used

true pumice
#

Depending on the application, the requirements change. Some check variables and their values, so check return values and others look for a specific set of keywords.

brazen eagle
#

the get_average function calls total which doesn't seem to be defined

versed bronze
versed bronze
brazen eagle
#

!docs verify

narrow terraceBOT
true pumice
#

What’s up?

#

@frigid egret

frigid egret
#

just realised its still under embargo lol sorry

true pumice
#

..

frigid egret
#

dw i still have no idea how to escalate :)))))

frigid egret
#

LMFAIO

solar hull
#

would they be triggered by asynchronous events or by requests/responses?

#

You likely have a response handler somewhere in your client. Make it trigger showing a popup. How to exactly do that would be specific to the used framework.

#

And make sure your API responses contain enough information for client to be able to populate that popup.

#

My assumption is that you want the API user to show the popups somehow. And they'll have to take care of showing it anyway.

#

I'm also assuming the API would not provide rendered content, but rather JSON or something.

sharp coral
#
<script> alert(1) </script>
#

theres your alerts :p

onyx merlin
#

Usually it's JSON or XML. Sometimes something weirder.

solar hull
#

My view of APIs is that they provide the data in a structured format, frontend or other API client handles all of representation.

solar hull
onyx merlin
#

If it's all in the backend then you get like... protobuf and stuff

solar hull
#

true - with JS i thought this is about backend to frontend style APIs. backend internal APIs make the world more interesting, it could be protobuf or gRPC etc.

brazen eagle
#

Can JS handle grpc?

solar hull
#

there is node grpc, at least.

brazen eagle
#

Yeah but I don't think there's a browser based implementation

solar hull
#

I don't think that'd make a lot of sense. It's not as if browser APIs should have strict performance requirements.

surreal bronze
#

okay, I have never touched databases / sql so need some help with this:

import sqlite3
tabel = sqlite3.connect("output.sqlite")

cur = tabel.cursor()
cur.execute("SELECT * FROM convert_to_db_sql")

rows = cur.fetchall()

for row in rows:
    print(row)

Why does this print an empty item in the tuple as well as the row?

#

everything works fine just the empty value is kinda annoying😅

magic falcon
#

Table structure may be having an impact.

#

SQLite also doesn't always behave like a full SQL product

surreal bronze
#

mk

#

ahhaha

#

my bad

magic falcon
#

And, if you ever do migrate from sqlite to a full on sql server, that WILL cause you no end to headaches

surreal bronze
#

Turns out there was an empty col 😆

surreal bronze
magic falcon
#

I think it's usually simpler to just start with a postgres or maria instance

#

Yeah, don't use SQLite for that

surreal bronze
#

Should I switch to full sql?

#

mk

magic falcon
#

You are going to make yourself full on crazy if you are planning on taking that to actual infra from a local dev

surreal bronze
#

Out of these:

PostgreSQL
MariaDB
MySQL
Oracle
SQLite
#

would you say?

#

we're looking at 1-2 tabels one for around maybe 10k items with ~4 cols

onyx merlin
#

sqlite is good if it's like... a single user

solar hull
#

(That's a matter of opinion, my one being the above 🙂 )

magic falcon
#

I would say postgres or maria - maria was intended to be a drop-in secure replacement for mysql.

#

It's all about preference - I think the documentation around mysql/maria is better than postgres, but postgres is a bit better when you know your way around a RDB

surreal bronze
#

okay apparently SQLite for testing, PostgreSQL for production is the way to go

magic falcon
#

oracle has subscription costs if you are going for the real deal, and mysql can be thought of as a cut-down featureset of oracle

#

sqlite is never the way to go for testing

#

because the db structure for django ORM is substantially different

#

if your app is intended to be run locally at all times (like cherry tree) sqlite will not pose problems

#

if the django app is intended to be hosted on a server with a grown up version of sql involved, then migrating your codebase and table structure from sqlite to postgres or maria will be a really, really terrible experience

#

if you are new to database programming and MVC with an external data model, do not use sqlite with the intent on replacing it in production

surreal bronze
#

Am using it with Django and hosting on Digital Ocean @magic falcon

lilac holly
#

how can i add two REG patterns to each other ?
so i got this pattern \w+@\w+.com to get a email
and i made an other one to search for phone number ; ((\d{3})) \d{3}-\d{4}
and i want to make a reg that return phone the email and the phone number at the same time but i dont understand how to add them to each other

true pumice
#

Why do you need regular expression for phone numbers and emails? @lilac holly

lilac holly
#

its a practice project

#

im learning py

true pumice
#

But why specifically phone numbers and emails?

lilac holly
#

im reading the Automate The Boring Stuff With Python and i came to a practice project there

#

that asked me to make a code that return email and phone numbers from a clipBoard

#

but it doesnt cover how to add two REG patterns to each other

magic falcon
#

that'll be covered in the py re docs

lilac holly
#

i'll check

#

nvm i figure it out

#

all i was missing was the pipe

#

|

solar hull
lilac holly
#

((\d{3})) \d{3}-\d{4}|\w+@\w+.com

#

solved my problem

solar hull
#

The state machine diagram in the post above is True Art.

stone kayak
true pumice
#

eww scraping

stone kayak
#

Hey! Thanks to @true pumice , @remote echo and @surreal bronze we just added ~100 new ways to contribute to open source. This is your chance to get involved in a project 😄

https://twitter.com/bee_sec_san/status/1371862410869506055

We just added 100+ new good first issues to Name-that-hash. Want to get started in Open Source but don't know how?

All this requires is a basic understanding of Regex :D
https://t.co/NsZ1wWMjq9

surreal bronze
#

go go go

#

free 1 month sub THM voucher jk, im poor ok

solar hull
stone kayak
#

I also forgot to tag it

#

but I am now away hahaha

barren garden
#

Hi community I’m real new to cyber security. I wanted to start coding. What language should I start? I heard often Python is a good way. What do you think ?

onyx merlin
#

Programming isn't that big a part. Python is a good first language.

brazen eagle
#

Python (3) is useful and generally considered beginner-friendly

#

coding isn't necessary, but it can be helpful

timber laurel
#

what is the most used programming language as for this date?

barren garden
#

Wauuu thanks for the quick answers I appreciate your input.

brazen eagle
#

depends for what purpose

timber laurel
brazen eagle
#

let me check

#

by the TIOBE index, C is most popular

steady anchor
#

cpp i think

brazen eagle
#

followed by Java, then Python

timber laurel
#

okay thx

brazen eagle
#

C++ in 4th

steady anchor
#

👀

brazen eagle
barren garden
#

Is there any good course or page out there to learn python ? Thanks for your input

brazen eagle
steady anchor
#

i used to watch tutorial of thenewboston on youtube

vernal vigil
#

Sentdex is really really good

#

and tech with tim too

steady anchor
#

^

stone kayak
brazen eagle
#

isn't that asserting that there's at least one kerberos in x?

stone kayak
#

oooh good catch!

brazen eagle
#

might need something like:

foreach(hash in hashes) {
    x = runner.api_return_hashes_as_json(hash)
    assert 'kerberos' in x
}
#

not sure how the reporting works on that though

red wave
#

Can someone help me out with trying to figure out the arm assembly implementation of this c function?

#

So I'm trying to figure out the implementation of this function, right

#

and I think I pretty much got it but the only thing I cant figure out is to implement that cast to 8 bits unsigned

red wave
#

Nevermind got it, my new problem is trying to debug this function

#

which is supposed to be an implementation of this function but Ive determined doesn't work

remote echo
#

🤣

balmy flint
#

Recently I read the blog post by muiri
Which gives clear explanation to RSA ,I need some extra help regarding resources in which I can implement it with for larger primes can anyone provide resources which speaks on finding larger primes and implementing it...

brazen eagle
#

pointer math is always a bit shaky though

thorn finch
#

Passport.js

magic falcon
#

Something OAuth compatible

brazen eagle
#

Passport.js looks to be an Express thing

thorn finch
brazen eagle
#

granted most node.js apis probably use Express to begin with...

bitter field
#

for auth I use urql if you want to go along with graphql

brazen eagle
#

hmm spectacle looks interesting

feral moss
#

C question:
Is it discouraged to define macro functions and use normal functions?
I don't get the benefit from using macro definitions as they can easily rise errors

magic falcon
#

Macros are a pre-processor replacement; it can make code harder to debug but there are hypothetical speed enhancements that can be made by using them. If there isn't a solid reason backing that decision, it's usually a standard practice to not use them

feral moss
#

that's what i thought

brazen eagle
#

we used macros a lot to wrap logging code

#

LOG_DEBUG("Stuff") rather than log("stuff", debug);

lilac holly
#

Someone that can help me with rop?

#

I tried to replicate a script
@DefCampRO
Quals in 2019 (https://app.cyberedu.ro/challenges/559e4ec0-7f21-11ea-b4cb-3db05c1cfb77/) but I my shell get's terminated. I tried to tweak it around for over a week now and I can't seem to make it work (https://github.com/1337pwn3r/HacktTORs/blob/master/DefCamp 2019/secret/exploit.py). Any advice is highly appreciated!

Explore 100+ cybersecurity challenges! Free signup. CTFs include web security, reverse engineering, network & traffic analysis, binary exploitation & more.

#

The expected outcome is

swift tulip
lilac holly
#

Yes

#

Can you give me the LinkedIn link, please?

lilac holly
#

Hello, I have a question, how do you build in that the browser takes a different proxy each time (javascript)? With authentication?

glass cape
#
import openpyxl as xl

wb = xl.load_workbook("transactions.xlsx")
sheet = wb['Sheet1']
cell = sheet.cell(1,1)

for row in range(2, sheet.max_row + 1):
   cell = sheet.cell(row,3)
   corrected_value = cell.value * 0.9
   corrected_value_cell = sheet.cell(row,4)
   corrected_value_cell.value = corrected_price


wb.save('transaction2.xlsx')
#

its giving me a error

#

on line corrected_value_cell.value = corrected_price

#

can some boady help me

onyx merlin
#

If you want help with an error, you need to show is the error

surreal bronze
#

Ye what's the exact error?

glass cape
#

unressolved reffrence corrected_price

surreal bronze
#

Can I have a screenshot?

onyx merlin
#

You never defined "corrected_price"

glass cape
glass cape
tulip ibex
#

yup

#

var not def

#

u havent specified the variable

onyx merlin
#

Where are you setting it?

glass cape
#

its a exel sheet that i want to automate

surreal bronze
#

Then as James said, you haven't set the corrected price

onyx merlin
#

Gotta love it when people ask for help then ignore it when they get shown the problem

glass cape
#
import openpyxl as xl

wb = xl.load_workbook("transactions.xlsx")
sheet = wb['Sheet1']
cell = sheet.cell(1,1)

for row in range(2, sheet.max_row + 1):
   cell = sheet.cell(row,3)
   corrected_value = cell.value * 0.9
   corrected_value_cell = sheet.cell(row,4)
   corrected_price = corrected_value_cell.value


wb.save('transaction2.xlsx')
#

now its good

onyx merlin
#

If there wasn't a problem then it'd be working.
Best to listen to people and see if they're right before arguing.

glass cape
surreal bronze
# glass cape

Just a tip, if you hover over the line with the squiggly red thing under it, it will tell you the error 😄

glass cape
#

thanks for helping

glass cape
supple heron
#

hey all, so I've got kind of a stupid question...I'm a noob with linux and python...I was watching a YT video where I guy was writing a python script in linux...he started it off with the following bit of code:

#!/usr/bin/env python3

onyx merlin
#

That's called a shebang, it tells Linux what interpreter to use to run the file if you do just ./script.py

supple heron
#

So it's basically the same thing as when I start off a bash script?

onyx merlin
#

Yep, exactly

true pumice
#

Yup, should be.

onyx merlin
#

Coincidentally, it's also how magic bytes on compiled programs work on Linux

supple heron
#

ah, gotcha, ok...thanks!

gusty crescent
#

I have an excel file with two tables in two different worksheets. Table A contains unique entries and a unique ID. Table B has the same ID and extends data to it. Now I have to merge those tables, any idea how to do that?

    - ID1 [valueTabA] [valueTabA]
    - ID2 [valueTabA] [valueTabA]
    - ID3 [valueTabA] [valueTabA]
    - ID4 [valueTabA] [valueTabA]
    
    Table B
    - ID1 [valueTabB1] [valueTabB1]
    - ID1 [valueTabB2] [valueTabB2]
    - ID4 [valueTabB] [valueTabB] ```
which should merge into:
```Table A
    - ID1 [valueTabA] [valueTabA] [valueTabB1] [valueTabB1] [valueTabB2] [valueTabB2]
    - ID2 [valueTabA] [valueTabA]
    - ID3 [valueTabA] [valueTabA]
    - ID4 [valueTabA] [valueTabA] [valueTabB] [valueTabB]``` 
Using python, how would you do that?
Currently I'm using openpyxl 
```import openpyxl

file = "excel/separated.xlsx"
wb = openpyxl.load_workbook(file)
dissection = wb["Dissection"]
damage = wb["Damage"]

current_row, current_line = 2, 2

for row in damage.iter_rows():
    # loop through first table
    id_A = damage.cell(row=current_row, column=1).value

    for line in dissection.iter_rows():
        # loop through second table
        id_B = dissection.cell(row=current_line, column=1).value
        copyData = []

        if id_A == id_B:

            for col in range(2, 39):
                copyData.append(damage.cell(row=current_line, column=col).value)

            for item in copyData:
                column_count = dissection.max_column

                dissection.cell(row=current_row, column=column_count).value = item
                column_count += 1

            current_row += 1
            break

        if not current_line > 409:
            # prevent looping out of range
            current_line += 1
        else:
            current_line = 2

wb.save(file)```
But it's not pasting the data to the cells plus I don't know how to append many rows behind each other (see example ID1)
modest elk
#

You can easily read a .xlsx file with pandas

gusty crescent
#

and how do I merge the tables with pandas? Sorry, never really used it

pulsar salmon
#

If a MySQL server is restricted to access only from its localhost, how can we spoof the MySQL server to access from remote?

solar hull
#

Tunneling/port forwarding/proxying?

pulsar salmon
tulip sail
#

Use another initial compromise method and tunnel that way

marble lark
#

Hey guys can anyone me guide me through how to learn reverse Engineering from the bare bottom, everything I found doesn't really have the basics and I m not a book guy more of a video guy

lilac holly
#

hi 😄

#

I'm new 😄

lilac holly
foggy junco
#

Hey @onyx merlin I just can't figure out where /api/login is handled in Overpass1. I wanted to reverse engineer the configuration to see what answers to login attempts to see what (and if) there are valid credentials to login with. Can the configuration (or routing?) for the "server" executable be found somewhere on the box or would i have to reverse engineer the whole executable to unravel the whereabouts of that endpoint? No i don't know that much about web programming and stuff

onyx merlin
#

It's a golang webserver

foggy junco
#

yeah figured that out with gorilla

onyx merlin
#

You aint gonna get the valid creds without reversing the binary. Because you're not meant to

#

The routing is all done in the binary

foggy junco
#

ah ok, couldn't find sense with grep Handlefunc *.go anyway

onyx merlin
#

I have an api boilerplate on my github that shows how it's done

#

I don't know if the source is even on the box?

foggy junco
#

i couldn't find it .. but that don't mean much ;P

onyx merlin
#

There is a valid password, but you'd never find it.

foggy junco
#

something over here?

onyx merlin
#

I recommend against reverse engineering it

#

Because it's going to cause you pain.

foggy junco
#

🤣

onyx merlin
#

There's genuinely no point

foggy junco
#

ok, then I'll put that one in the pain chest and lock it away
yeah, the only pint is practise

onyx merlin
#

There's probably golang RE exercises on the internet that you're actually meant to complete

foggy junco
#

yeah, thanks anyway and have a nice day!

remote echo
#

GOlang reversing is pain

#

It has a lot of things lol

brazen eagle
#

oh yeah the login is totally broken

onyx merlin
brazen eagle
# onyx merlin ?

for overpass? you aren't meant to brute force it but it's still deliberately broken

onyx merlin
#

It works

#

You just don't have the creds

brazen eagle
#

probably assuming you find creds

onyx merlin
#

It aint broken

#

Spoiler.

brazen eagle
#

there are writeups

#

but alright

onyx merlin
#

No sense spoiling people who don't go looking for it.

brazen eagle
#

point taken

glass cape
#

got to know about a tkinter i am thinking of making a calculator as a fun project but how will i integrate my code with this gui

vernal vigil
#

read docs, usually helps

glass cape
vernal vigil
stark pulsar
#

This question is related to Discord.js

sly frigate
#

Hello, I am currently in a hackathon and I need some help, can anyone please help me out here

#

Company: Koshex
Domain: Machine Learning and Web Development
Introduction:
The idea is to help people view and study their overall spend analysis by developing a simple web app to analyze all the purchases made by scanning the credit card and bank statements.
Expected Solution:
Use any method to parse the PDF and track payments. Using AI and machine learning, the app should be able to group items category-wise, for example, food, clothes, fuel, etc. on a date range view i.e weekly/monthly/yearly The solution should run on at least 5 different bank and credit card statements e.g. ICICI, HDFC, SBI, YES, AXIS
Additional Requirements: (If Time permits) The app should prompt users when they overspend or make repeat purchases

#

This is the problem statement

vernal vigil
#

What do you need help with tho?

queen bane
#

Everything probably? 😁

vernal vigil
#

Um, just break the problem into tasks

sly frigate
#

I'm through with the i/p part, as I recently started ML I do not have idea as to how we display the data on the site directly

#

As in taking the pdf and conv it into csv- Through with this

vernal vigil
#

Id say work on the ML side first, cuz thats the important part.

sly frigate
#

And my front end is ready

vernal vigil
#

There are pdf/Cv parsers out there where they will give you literally everything you need.

#

When you've figured that much out, just use algorithm from Sklearn Algorithm map

sly frigate
true pumice
#

Lethal_Hitman, I hope this is not active and you’re getting prizes for doing this.

vernal vigil
#

I think yeah, i haven't used em in a while

sly frigate
true pumice
#

If it’s homework or an assignment, we usually avoid giving too much help too. You need to show your teacher what you can do.

sly frigate
#

well, she just taught us abc and has asked us to submit an essay. So here I am, stuck

#

And this is like, I want to know how things work, but do not know how to put things together here

sly frigate
molten rose
#

in developing a cryptocurrency, are there any gotchas I should look out for? I'm building a currency for a client and wanted to make sure I didn't step into any holes. I understand the mechanics involved (p2p network with a distributed blockchain with consensus-based persistence and transactions protected by ssh keys). I am planning on using IPFS for network management (although currently I'm using webrtc because convenience), DNS style consensus management, and rolling my own block style for transaction that looks something like <Sender Public Key> SENT <crypto amount> TO <Receiver Public Key>\n<encrypted digest as signature>

short tangle
#

Hello i have problem with my code and iam learning soo, i cant fix this bug.... And i was trying for 3 hours soo can someone help me with C#? its calculating program for block like surface and volume.

#
using System;

namespace VSkvadru
{
    public class Program
    {
        public float a;
        public float b;
        public float c;
        public float V;
        public float S;
        public static void Main(string[] args)
        {
            vstup();
            vypis();
        }
        public static void vstup()
        {
            Console.Write("Enter a in cm: ");
            string retezeca = Console.ReadLine();
            float a = float.Parse(retezeca);

            Console.Write("Enter b in cm: ");
            string retezecb = Console.ReadLine();
            float b = float.Parse(retezecb);

            Console.Write("Enter c in cm: ");
            string retezecc = Console.ReadLine();
            float c = float.Parse(retezecc);

            Console.WriteLine("You entered: {0}, {1}, {2}", a, b, c);
            Console.ReadKey();
        }
        public void objem()
        {
            float V = a * b * c;
        }
        public void plocha()
        {
            float S = 2*(a*b + a*c + b*c);
        }
        public static void vypis()
        {
            Console.WriteLine("Volume is: {0}", V);
            Console.WriteLine("Surface is: {0}", S);
            Console.ReadKey();
        }
    }
}
solar hull
surreal bronze
#
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse
from django import template

@login_required(login_url="/login/")
def index(request):
    
    context = {}
    context['segment'] = 'index'

    html_template = loader.get_template( 'index.html' )
    return HttpResponse(html_template.render(context, request))

@login_required(login_url="/login/")
def pages(request):
    context = {}
    # All resource paths end in .html.
    # Pick out the html file name from the url. And load that template.
    try:
        
        load_template      = request.path.split('/')[-1]
        context['segment'] = load_template
        
        html_template = loader.get_template( load_template )
        return HttpResponse(html_template.render(context, request))
        
    except template.TemplateDoesNotExist:

        html_template = loader.get_template( 'page-404.html' )
        return HttpResponse(html_template.render(context, request))

    except:
    
        html_template = loader.get_template( 'page-500.html' )
        return HttpResponse(html_template.render(context, request))

So this is an example of making the user have to login before accessing any page, How can I make so they can access a certain .html page without being logged in

#

Would you have to do like?

{% if not request.user.is_authenticated %}
short tangle
solar hull
thorn finch
surreal bronze
# thorn finch You can use that if statment to show/hide specific things in a page, but you hav...

Okay, so when I do this it works except it says "404, not found" on the table data.html, but if I login the table data.html works fine

# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse
from django import template

@login_required(login_url="/login/")
def index(request):
    
    context = {}
    context['segment'] = 'index'

    html_template = loader.get_template( 'index.html' )
    return HttpResponse(html_template.render(context, request))

def pages(request):
    context = {}
    # All resource paths end in .html.
    # Pick out the html file name from the url. And load that template.
    try:
        if request.user.is_anonymous:
            load_template  = "/tables-data.html"
        else:
            load_template      = request.path.split('/')[-1]
        
        context['segment'] = load_template
        
        html_template = loader.get_template( load_template )
        return HttpResponse(html_template.render(context, request))
        
    except template.TemplateDoesNotExist:

        html_template = loader.get_template( 'page-404.html' )
        return HttpResponse(html_template.render(context, request))

    except:
    
        html_template = loader.get_template( 'page-500.html' )
        return HttpResponse(html_template.render(context, request))

thorn finch
surreal bronze
thorn finch
#

You are probably hitting this

    except template.TemplateDoesNotExist:

        html_template = loader.get_template( 'page-404.html' )
        return HttpResponse(html_template.render(context, request))
surreal bronze
#

Top is logged in, bottom is logged out

thorn finch
#

The template tables-data.html is not found, check the path

surreal bronze
#

ahhhhhhh

#

there we go

#

yup, was a spelling mistake 😅

thorn finch
#

😄

surreal bronze
#

@thorn finch it broke it ignore, was a token error

thorn finch
surreal bronze
#

Also, do you know how to make the table from an SQL tabel?

thorn finch
#

Are you using models ? @surreal bronze

surreal bronze
thorn finch
#
objList = Model.objects.all()
context['objList'] = objList
{% for obj in objList %}
<h1>{{obj.name}}</h1>
{% endfor %}
surreal bronze
#

if it helps im using an admin template

thorn finch
#

Switch up the attribute name from name to whatever ur using, and the Model to the appropriate model name

surreal bronze
thorn finch
#

It's not very clear in all honesty

#

If you want DM me the repository and i'll see what I can do

#

I'll be back in a bit though

surreal bronze
cursive zephyr
#

hi so im learning assembly x86 and was wondering i saw that the E of EAX is for extended can i use AX?

graceful quartz
#

I have a strong feeling you can but give it a try 🙂

cursive zephyr
#

oh okay thanks

surreal bronze
#

Anybody experience in Django, I cant seem to access the site from my computer --> DigitalOceans server which I'm running it on.

#

Getting a refused to connect. when trying to access the site but if I ping the server it responds fine

#

Its the right the port as well, is this djangos fault or the DO server?

swift tulip
#

can you access it from your mobile phone?(3/4G)

#

@surreal bronze

#

might be DNS

surreal bronze
#

Im connecting to it from its IP

#

and no,

onyx merlin
#

Firewall?

swift tulip
#

yeah, that's all of my extensive knowledge of django cri sorry

bitter field
#

~~use React instead 😄 ~~

surreal bronze
onyx merlin
#

What OS?

surreal bronze
#

Ubuntu

onyx merlin
#

Yeah you might need to add a firewall rule then

surreal bronze
#

sudo ufw allow 8000 This makes a firewall rule right?

#

Still doesn't work :(

onyx merlin
#

I don't use ubuntu with a firewall

#

Got a firewall applied to the droplet with DO?

surreal bronze
#

Yeah should do

onyx merlin
surreal bronze
#

Yes!!! it worked!

surreal bronze
onyx merlin
#

My droplet didn't have that set up, interestingly

surreal bronze
#

Yeah thats weird, anyway.....now time to setup domain and SSL 😅

sharp coral
#

certbot!

tulip sail
#

Digital Ocean Ubuntu servers have an open firewall by default 👀

onyx merlin
#

Yea, mine did

tulip sail
#

What the heck did you do to that droplet Jayy?

sharp coral
#

yeah I recall not having to do anything to my DO droplet when I first set it up

surreal bronze
#

Tbh I have no idea....I'm just happy it works 😆

stone kayak
#

I'm amazed you're using DO and not abusing the fact that you have full admin credentials to my personal AWS account

surreal bronze
#

how could you accuse me of such thing!

it wasnt accepting my password vent

iron haven
#

How do you make python print something in Rot13?

mortal flint
iron haven
#

@mortal flint that’s in python 2

mortal flint
#

python 3's print is just print()

#

most of the other stuff works the same way, or is similar

onyx merlin
#

Please don't ask about deauthing here, it's illegal/unethical

fleet vortex
#

So I'm programming a text editor in java and I need to print the line that is being edited while editing it (to stdout), I'm pretty stuck and would appreciate some help

brazen eagle
#

curses can probably do something like that

#

but that`s a linux thing

craggy violet
#

hey guys could i get some help?

#

so I'm trying to pass a Label as a button click event handler in C#, but it dooesn't work

#

any ideas?

lilac holly
#

Whenever I want to install Library or module for python 2.7 using pip install it gets installed for python3

onyx merlin
#

Yeah, pip points to python3 pip now.

#

You need to install pip for python2 specifically if you want pipe for python2. If you're writing code, stop using Python2.

onyx merlin
#

Shouldn't need to install anything for py2

tulip sail
#

python2 -m pip install requests

onyx merlin
#

Muir made sure of that, I thought.

tulip sail
#

Or whatever it's looking for

lilac holly
lilac holly
onyx merlin
#

It should be a python3 exploit

tulip sail
onyx merlin
#

Right?

tulip sail
#

It's a python2 exploit unfortunately

onyx merlin
#

I mean it worked for me

#

Straight out of the box Kali 2021.whatever

tulip sail
#

That's why I deferred judgement -- it was working for me on a new install too

swift tulip
#

after using it i had no issue at all either using pip2 or python2 in general

fleet vortex
#

How do I include part of a paragraph inside a class in HTML?

#

For example if I have <p>Hello <strong>World!</strong></p>

#

this will make "World!" appear in bold, and I want to do this but with a custom class

cursive orchid
#

typically you'll use a <span> tag

fleet vortex
#

exactly what I was looking for, thanks a lot

onyx merlin
fleet vortex
surreal bronze
#

Is it possible to add a client side cool down on a button with DJANGO / JS? I currently have them sign up if they want to do the form but would like to add a cool down for extra measures

cursive orchid
#

you could use setTimeout?

onyx merlin
#

@FirstclassBusinessCat#8535 This sounds like an advert.

#

This also sounds incredibly sketchy.

#

@FirstclassBusinessCat#8535

#

And they're gone?

lone peak
#

.rank

surreal bronze
#
                                            {% for obj in notify %}
                                            {% if request.user.username == obj.username}
                                            <a href="#">
                                                <div class="notif-icon notif-success"> <i class="fa fa-comment"></i> </div>
                                                <div class="notif-content">
                                                    <span class="block">
                                                        {{obj.msg}}<br></br>
                                                        <br>{{obj.time}}
                                                    </span>
                                                </div>
                                            </a>
                                            {% else %}
                                            {% endif %}
                                            {% endfor %}
``` Sorry about the formatting, anybody know why this is giving a "Invalid block tag on line 68: 'else', expected 'empty' or 'endfor'. Did you forget to register or load this tag?"
#

@thorn finch any ideas? 😄

thorn finch
#

Remove the else line @surreal bronze

surreal bronze
#

:(

thorn finch
#

{% if request.user.username == obj.username %} @surreal bronze fix this line

surreal bronze
#

what needs fixing on that? @thorn finch

#

(The model does have "username"

solar hull
#

you're missing % before the closing brace.

surreal bronze
#

Where?

solar hull
#

{% if request.user.username == obj.username}

surreal bronze
#

ahh yup got it

#

my bad

#

thanks lol that went straight past me haha

solar hull
#

TBH that looks like something your editor should catch. But then again I'm not that familiar with django templates or tooling to work with those.

surreal bronze
#

😭

#

@thorn finch dont u love css formatting terribly

thorn finch
#

Hahaha I hate css

sly breach
#

Oh you don't know pain until you do CSS in the task editor for rooms holy moly

dull tangle
sly breach
#

kekw imagine how I feel

#

tryna compete with this whole fancy styling people are adding and I'm just face-desking everything

#

Although I gotta say

#

I'm very proud of this

dull tangle
#

That’s either a screenshot or 3 hours of work right there I can’t tell 😳

sly breach
#

3 hours of work if you don't include the face-rolling over the keyboard

#

😄

dull tangle
#

Witch craft right there!

sly breach
#

Once the room is out the colour will make sense

#

I mean you can probably infer just given by the screenshot...

fleet vortex
#

I'm trying to permanently add a directory to $PATH, but the following is not working : echo "export PATH = /home/directory:$PATH" >> /home/.bashrc

#

What am I missing?

#

for what I have understood, by adding "export PATH = /home/directory:$PATH" to ".bashrc" I should be able to make it

faint sparrow
#

try using quotes when exporting the stuff, might help you

# standalone export
export PATH="/home/directory:$PATH"
# As echo into .bashrc
echo 'export PATH="/home/directory:$PATH"' >> .bashrc
fleet vortex
#

Thanks for the answer tho!

faint sparrow
#

what's the directory you're trying to add?

fleet vortex
#

/home/kali/myTools

faint sparrow
#

and i presume the executable you want to be in path is directly in that folder?

fleet vortex
#

yep

faint sparrow
#

🤔

fleet vortex
faint sparrow
#

are you on latest kali?

fleet vortex
#

haven't checked but I think so

faint sparrow
#

if you're on one of the newer ones unless you switched the default shell, you'll have to modify .zshrc, not .bashrc

#

run echo $0 and see what the output is

remote echo
fleet vortex
faint sparrow
#

then edit .zshrc

fleet vortex
#

still nothing

faint sparrow
#

did you import it after modifying?

fleet vortex
#

nope, how's that?

faint sparrow
#

either restarting the shell or running source ~/.zshrc

#

welp there's your problem 😄

fleet vortex
#

okay thanks a lot!

faint sparrow
#

you need to re-import .zshrc after changes

fleet vortex
#

it is now in $PATH hahahaha

#

thank you for your timeblobfingerguns

#

if I want to add an alias I have to do it in .zshrc too right?

faint sparrow
#

yup

fleet vortex
#

and re-import it afterwards 😉

inner yarrow
#

any one help me out for penetration testing

surreal bronze
#

what do you need help with @inner yarrow

humble venture
brazen eagle
#

😮

#

oof, implementing ping in python is hard 😦

true pumice
#

import os

#

os.system

magic falcon
sour siren
#
Number(Math.trunc((some_float  * some_int / 100) * 100) / 100)

in my mind this part of code have to delete all extra numbers in fractional part, but i still get this:
can you tell me, why is it so ?
is problem in dividing by 100?

magic falcon
#

Truncating isn't the same thing as floor. Think about the data types involved and what the binary representation of the type is.

sour siren
#

ok, i will learn more)

remote echo
magic falcon
brazen eagle
#

ICMP ECHO

magic falcon
#

yep, layer2

brazen eagle
#

the RFC seemed easy enough

#

.<

magic falcon
#

i saw a blog about that awhile back, let me see if i can dig it up

brazen eagle
#

I found a few

magic falcon
#

that might have been for py2

brazen eagle
#

not a fan of the implementations I found though

magic falcon
#

py3 is different enough i wouldn't trust that info

#

are you using any pypi libs?

#

just socket or anything fancier?

brazen eagle
#

just socket, but I think I'm going to give up and farm it out to the ping command 😄

magic falcon
brazen eagle
#

I can't guarantee any libs on the target

#

yeah I saw that

magic falcon
#

it's a pretty good implementation, i don't see anything that raises red flags

brazen eagle
#

using it as a base

onyx merlin
brazen eagle
#

his structs are a bit off

onyx merlin
#

Or go program

brazen eagle
#

oh probably a better idea than python sockets

magic falcon
#

the C networking libs, if you have not used them, take some getting used to

brazen eagle
#

no doubt

onyx merlin
#

Just bear in mind, either way if you're using raw sockets you'll need root or capabilities

brazen eagle
#

might be a good rust project though

magic falcon
#

not gonna lie, they were one of hte least favorite parts of my entire undergrad experience

brazen eagle
#

I have the packet class, though I should unit test it...

magic falcon
#

if you are going to do it in c/c++ give the boost a spin

brazen eagle
#

maybe I'll write it in Kotlin and use graalVM to compile to static 😄

#

runs

magic falcon
#

actually, is the C++ networking TS included offiicially in the standard yet?

brazen eagle
#

haven't looked into the C++ standard is at least a decade

magic falcon
#

c++11 and newer has changed a lot

brazen eagle
#

yeah I know

magic falcon
#

it doesn't look like the networking TS is rolled in yet

brazen eagle
#

Pretty sure in what little C++ I do do, the vendor doesn't support anything newer than C++08

magic falcon
#

it's basically the boost networking lib, anyway

#

what version of what compiler are you using?

brazen eagle
#

and the stl is banned

magic falcon
#

GCC 4+ supports 11

#

.... wut?

brazen eagle
#

MSVC gods I can't remember

#

whatever comes with 2015

magic falcon
#

yeah, i wouldn't mess around with C/C++

#

MSVC compiler drove me crazy enough i swore off doing C/C++ on windows

brazen eagle
#

oh that's vendor specific restrictions

#

as well

magic falcon
#

you aren't using that crazy IBM C++ generator are you? that thing is the devil

brazen eagle
#

they include a homebrewed module system that breaks when you use the STL...

#

naw

#

works fine as long as you don't try to do anything specific in it

#

w00t

#
❯ sudo python3 port_scan.py
DEBUG :: Payload: b'\x00\x08q\xc96\x86\x00\x00'
Host: 127.0.0.1 is reachable
#
❯ sudo python3 port_scan.py
DEBUG :: Payload: b'\x00\x08\xc5G\xb82\x00\x00'
Host: 10.200.86.200 is not reachable
#

works 😄

onyx merlin
#

Now what will you do about machines that don't respond to pings?

brazen eagle
#

include a flag to say **** you and scan the thing anyways

#

that's not what -f means?

magic falcon
#

oh snap, am i seeingthat correctly? you got raw hex strings to render correctly in py3? please share your secrets

brazen eagle
#

uhh print(f"{bytes}")

#

it's a bit wonky

magic falcon
#

😦 last time i was doing BOF stuff, I couldn't get py3 to render correctly using b' or f""

#

had to step back to py2

brazen eagle
#

oh the bof stuff is a bit wonky

#

I get it working a while back, hang on

magic falcon
#

you're a champ, write a blog on that. there are 3 COP and SIGs at my employer who would love to read it

brazen eagle
#

haha

#

trying to remember where there was a bof recently

#

right it was for theseus

onyx merlin
#

That'd better not be a spoiler for the room

brazen eagle
#

you write to the raw buffer instead of using print

onyx merlin
#

Because that room is no help/hints

brazen eagle
#

that's to explore the bof

#

not to exploit it

#

I was editing it

#

to remove the bits

tulip sail
#

Might be best changing it to have a different offset

#

Oh, sorry 😅

brazen eagle
#

ah yeah ok

tulip sail
#

Yeah, all good if it's not directly from the room 🙂

brazen eagle
#

that might've been the actual exploit

#

looking at it again

#

ok key part for py3 is this bit anyways

#
sys.stdout.buffer.write(payload)
#

probably similar for direct to file

#

the rest seems to be all the same

magic falcon
#

Interesting. it should work for any raw buffer, then

brazen eagle
#

yeah

magic falcon
#

and the whole time, we thought the point of using high level languages was to not do stuff like that

brazen eagle
#

the print function probably does some formatting voodoo before shoving it out to the buffer

magic falcon
#

it would make sense - i know there is some kind of ascii/unicode pretty print going on

brazen eagle
#

probably unicode

magic falcon
#

by default

#

yeah

brazen eagle
#

to the terminal? probably utf-8

magic falcon
#

you can specify format as a positional arg IIRC

brazen eagle
#

gods where did I find that bit about using raw buffers...

#

probably looking up BOF and python3 on google pointed to some forgotten stackoverflow...

magic falcon
#

That needs a +1 for sure

brazen eagle
#

yeah

#

I'll add writing a blog post on my todo list, or throw it to @grave salmon to update his BOF tutorial

grave salmon
#

👀

brazen eagle
#

BOF in py3

#

or developping rather

grave salmon
#

There's a reason why I used python2.7

#

don't make me deal with encoding things kekw

brazen eagle
#

yeah but py2 is dead now 😄

#

anyways I didn't have to encode anything, I used raw bytes

#

b"<bytes go here>"

grave salmon
#

that's really the tricks, using raw bytes usually fixes everything

brazen eagle
#

it's outputting to console or file that breaks things a bit

#

using print

grave salmon
#

I merely avoided using python3 alltogether in my tut because I wanted to avoid this discussion and actually teach the BOF process itself which is largely language agnostic heh

brazen eagle
#

true, ok

magic falcon
#

can't be language agnostic if the most common language right now breaks the flow

grave salmon
#

write it in go :p

magic falcon
#

but that means go

brazen eagle
#

technically you don't need py2 😛

grave salmon
#

write it in rust

brazen eagle
#

C would probably be the easiest

grave salmon
#

write it in py3 but use raw bytes and propper conversion when printing to console

magic falcon
#

C would be easiest until you get to the networking lib

brazen eagle
#

naw, it's use the raw buffer when printing to console

grave salmon
#

the possibilities are endless

grave salmon
brazen eagle
#

converting doesn't work

#

because print is wierd, and expects a string

grave salmon
#

and well.. because they ARE raw bytes

#

And their visual representations are kinda pointless...

brazen eagle
#

ye

grave salmon
#

same thing if you try to feed a bytearray to find badchars, just make sure to use raw bytes in py3 otherwise you'll think everything's gone broken

brazen eagle
#

yup

grave salmon
#

Might edit the line Python3 is fine, just make sure you encode everything correctly. That's outside the scope of this Tutorial, but feel free to play with it. to include "just make sure to use raw bytes and print things with stdout.buffer instead" on my tutorial... but I need to get working on the next tut in the series 😄

brazen eagle
#

yesh

vast thorn
#

Checking forward slash if exist then create directory if not then text , Current code
if [[ "$string" == / ]] ; then echo "get word before forward slash make mkdir is there any way i can do that ?" ; fi
,. tee directory/text

forest dawn
#

hello

surreal bronze
#

Hi!

stone kayak
#

and ofc the poll doesn't embed in Discord...

surreal bronze
#

YAML ftw

tulip sail
#

(Yes, I'm kidding)

icy valley
#

hey

#

is there anyone who can help me in my project Java?

vernal vigil
#

Ask your question Jack, someone might be able to assist ya

icy valley
#

I need to send the project to see it

#

but it couldn't send here

onyx merlin
#

Do you have an account on tryhackme?

icy valley
icy valley
icy valley
onyx merlin
#

!docs verify

narrow terraceBOT
icy valley
lilac holly
#

yoooo

#

so im just thinkin

#

do i learn c++ or python, idk how to code but im doing compsci for gcse and coding seems fun

#

my mate said c++ is good cause it can do more things apparently

#

but we doing python in school

#

so

#

i dunno

onyx merlin
#

You're at GCSE. Stick with python, get the fundamentals down, then you can learn new languages easier

lilac holly
#

betttt

#

say less

formal kettle
lilac holly
#

The Slav — 12/03/2021
Well here is some guidance. If you are learning code for just school learn Python. If you want a bit of a challenge, but allows you to make your own games and stuff learn C++.

#

yea thats what i have him saying from lost time

formal kettle
#

not sure what you mean, with ight bet, i would use phaser for games,

onyx merlin
#

I'd learn C# and do unity, or learn unreal

lilac holly
#

so learn those

#

for games

#

?

formal kettle
#

i don't reccomend you spread out 5 languages at the same time , like James said learn the fundamentals of one , really understand it, then when you go to a new language you start kind of comparing it to your first language if that makes any sense

#

I don't think the C languages are good to start, maybe JS or python ,,,

onyx merlin
#

I'd avoid JS

#

JS is weird

formal kettle
#

whatever, lol

#

JS rules

#

it will have you looking for a semi colon for hours,,,, python solved that

onyx merlin
#

it will have you looking for a semi colon for hours - Except it doesn't

formal kettle
#

?

onyx merlin
#

JS does not need semicolons

formal kettle
#

;

onyx merlin
#

it works just fine without

#

JS handles types in a really weird way that's super confusing for beginners

formal kettle
#

you mean what's inside an array

onyx merlin
#

No

#

I mean the whole handling of dynamic typing.

#

JS is a great language once you know how to code.

glass cape
#
nums = [2,4,5,6]
msg = "Numbers: {0} {1} {2} {3}". format(nums[0], nums[1], nums[2] , nums[3])
print(msg)```
output = Numbers: 2 4 5 6 my question 1. what this code is doing in 2 line and how do we verify that output is a string
onyx merlin
#

That last line is not valid python

glass cape
onyx merlin
#

So show that.

#

Did you type into google python get type of variable?

glass cape
#

is it okay now

#

i know that format function will give a formatted string but i am unsure that why "Numbers: {0} {1} {2} {3}" this line is there

onyx merlin
#

That's the format string?

glass cape
onyx merlin
#

I've given you the name for what it is. The logical next step is googling that term like python format string.

formal kettle
#
let early = true;
const age = 19;

if (early && age > 18) {
  raceNumber += 1000;
  }

if(early && age > 18) {
  console.log('Race starts 9:30am and your Number is: ${raceNumber}.');

} else if { (!early && age > 18) {
  console.log('Race starts 11am and your number is: ${raceNumber}.');

} else if (age < 18) {
  console.log('Race starts at 12:30pm and your race Number is: $ { raceNumber }.');
  
} else (age = 18) {
  console.log('See front desk please')

}
}```
so if I remove all those semicolons it will work?
onyx merlin
#

Probably.

#

Notice how that last else doesn't have a semicolon on the console log

#

There's a thing for you to read

formal kettle
#

thows an error , if you put ; i believe

onyx merlin
#

Why would adding an appropriate semi colon cause an error?

formal kettle
#

last else statement , maybe,

onyx merlin
#

No.

#

because ; terminates lines

formal kettle
#

cool, I guess I learned it "old school", and yes I would prefer to used them it would visually help me, when I don't see them think python,

solar hull
#

Some style guides suggest using semicolons, others do not.

formal kettle
# onyx merlin https://flaviocopes.com/javascript-automatic-semicolon-insertion/

Interesting, trying to wrap my head around this, he doesn't cover classes, switches, or loops, was looking at a switch example and trying to figure out what type of error it would make if any,

  const randomNumber = Math.floor(Math.random() * 3);
  switch (randomNumber){
    case 0:
    return 'rock';
    case 1:
    return 'paper';
    case 2:
    return 'scissor';
  }
};```
#

That was a great JS refresher session, should get back to my file upload room, lol

onyx merlin
#

Semicolons end statements.

#

That's all

#

It's not going to error out if you end a statement with a semicolon. That's appropriate use of a semicolon.

tidal panther
#

I'm learning javascript right now and I'm loving it just because the curly braces and semi colons remind me of C 🙂

peak mango
#

Yes. C syntax langs are good because no need for another syntax acquisition

surreal bronze
peak mango
#

Oh no discrete maths

rapid notch
#

Anyone here familiar with fetch api? I'm running into some issues and could use some help.

onyx merlin
#

I use it, if you mean the JS one

rapid notch
#

Yes. I do.

#

I'm trying to send a username and password but query parameters are being sent to my original url instead of the url I place in fetch(url).

#

I'm not sure if it's a problem with my submit button or if I've setup my request incorrectly.

#

@onyx merlin any ideas or suggestions?

onyx merlin
#

Without seeing code etc, I have no idea what you mean.

rapid notch
#

What would be the best way to show you the code?

onyx merlin
#

Depends how much code there is.

rapid notch
#

1 HTMl file (24 lines)
1 JS file (47 lines)

onyx merlin
#

Just the relevant JS then, between code tags, with syntax highlighting.

spark cypress
#

Im trying to make a script that intercepts keystrokes, not logging them but actually preventing them from being read by the host while listening for keystroke combo ie. ctrl+q to end the script. I am not even sure where to start with this as the system this will run on I cant read or write to the reg keys. Anyone have any thoughts? It would be used on a win 10 host with a strict STIG.

humble venture
#

Sooooo.. stopping someone from exiting a program?

spark cypress
humble venture
#

Wow. That sounds unethical as hell.

#

What would it be used for?

spark cypress
#

Training exercise, not sure what the use case outside of that, I just get told to make things, not why they need made unfortunately. Im more hardware oriented, so producing the HID hardware and flashing it is my thing, crafting the payloads is harder for me.

humble venture
#

Do you work for a black-hat hacking company?

spark cypress
#

which isnt saying much. As an organization the army's cyber practices are appalling and their talent management/retention is worse. But people are waking up the importance of security, so the idea is make a usb that can brick a laptop that is critcal on an exercise but that is easily used and reversed by untrained users.

humble venture
#

As much as it sound interesting, I'm not sure you'll be able to get the help you want around these parts.

spark cypress
humble venture
#

More-or-less, yeah.

#

As much as you are coming across as someone who knows what they are talking about, you have no idea how many people we get through here that ask for stuff like DDoser and stuff as 'Educational only' or 'for work'. We just gotta be cautious, y'know

#

As we're also a partnered server we gotta be even MORE caustiouser (Its a word, promise) than usual

lilac holly
#

what are good active programming servers?

rapid notch
#

What do you mean by active programming servers?

#

Oh and NinjaJc01 | James sorry for not getting back to you. I found out the problem I was having was due to my form action.

lilac holly
#

@rapid notch On discord, where you can ask questions and stuff

#

I am not sure i can ask here, lol

true pumice
#

What can’t you ask?

lilac holly
#

general questions i might get while working though my courses

true pumice
#

Why would you think you can’t ask? :)

onyx merlin
true pumice
#

I’d love to help if you’re learning programming

lilac holly
#

great, i will ask away then!

true pumice
#

Awesome!

limber locust
#

Anyone here good with Java?

#

Dm me if you are, thank u :)

onyx merlin
#

I'm decent at Java, but why DMs? @limber locust

limber locust
onyx merlin
#

Blegh homework help

limber locust
#

Lmfao it's not like I haven't written anything

#

Or not put effort in like most ppl

onyx merlin
#

Still don't get why it has to be DMs