#go-nuts

/

      • eric_lagergren joined the channel
      • eric_lagergren has quit
      • abpa has quit
      • tat_ joined the channel
      • sbezverk joined the channel
      • wkmanire joined the channel
      • eric_lagergren joined the channel
      • sbezverk
        hey, I need to get Gid for a folder, anybody could point me to the right api call? It seems I cannot find it in the doc..
      • eric_lagergren has quit
      • systmkor has quit
      • systmkor joined the channel
      • eric_lagergren joined the channel
      • eric_lagergren has quit
      • PichuChen has quit
      • OtakuSenpai has quit
      • systmkor has quit
      • echlebek
        sbezverk: https://golang.org/pkg/os/#FileInfo gets you the data, but you'll have to deal with what Sys() returns as Gid is os-specific.
      • sbezverk: if it's not there, you'll have to call out to C
      • sbezverk
        echlebek : got it thanks a lot!
      • systmkor joined the channel
      • cheako joined the channel
      • tat_ has quit
      • cheako has left the channel
      • rebase has quit
      • lstanley has quit
      • rebase joined the channel
      • lstanley joined the channel
      • echlebek : I see sys returns struct, do you know there is a linux dependent definition in go?
      • dimitarvp has quit
      • pepee joined the channel
      • echlebek
      • wkmanire has left the channel
      • sbezverk
        echlebek super, thanks a lot
      • alrs joined the channel
      • doublek has quit
      • doublek joined the channel
      • moloch joined the channel
      • noexcept_ has quit
      • pressure679 has quit
      • andyhuzhill joined the channel
      • doublek has quit
      • robscomputer joined the channel
      • nick123 joined the channel
      • fibbot joined the channel
      • pressure679 joined the channel
      • robscomputer has quit
      • fibbot
        Would anyone be interested in helping out with a CTF style problem? New to Go, and been stuck on it for hours now
      • sedition
        if you post your code on play.golang.org people will assist if they are able :)
      • wkmanire joined the channel
      • fibbot
        Sure thing, had it on pastebin but let me put it over there real quick
      • I put a comment above/below the area we are allowed to modify
      • wkmanire
        fibbot: What's this?
      • fibbot
        It's a Go exercise from a github game, like CTF style problems where you try to get through the levels
      • wkmanire
        CTF?
      • fibbot
        Capture the flag
      • sedition
        what's the goal of this exercise though?
      • what're you supposed to solve for?
      • fibbot
        This one you're supposed to get the status to change to "idle"
      • moloch has quit
      • wkmanire
        but foundIntruder is always true?
      • fibbot
        Right
      • danthemyth joined the channel
      • wkmanire
        const foundIntruder bool = true
      • fibbot
        Can only modify that one area I have comments above/below
      • nuizzy has quit
      • Yep, I was thinking maybe there was a way to modify const values by reference or something, but found that's not possible (a good thing, I imagine :P) so trying to figure out how to get around it
      • wkmanire
        This doesn't any sense to me.
      • It seems the status is based on the value of the const and there are conditions which check its value .... which never changes
      • fibbot
        Yeah, it's level 4/12 though and there's a leaderboard of people that have finished the whole game so I know it's possible
      • wkmanire
        How is the result verified by the site?
      • fibbot
        When it prints "Status: Idle" I think it'll pass
      • Otherwise it just says "try again" or something like that
      • sedition
        what site is this?
      • their Go is not good
      • lluad
        fibbot: Hint: online() returns a RecordingDevice. The record() function is specific to a Camera. You don't have to return a Camera{} from the online() functions.,
      • (It's actually quite a decent test of whether someone knows what a Go interface is and how it works)
      • chachasmooth has quit
      • ziyourenxiang has quit
      • fibbot
        That's what I was thinking about lluad, I'm just not sure what I should be passing. I've done a few CTF's of bash/c/c++ and stuff, but Go is still new for me
      • wkmanire
        It seems like a contrived problem around a specific mechanic of Go. I'm a Go newb though so what do I know? :)
      • lluad
        fibbot: Have you done the Go tour? tour.golang.org
      • chachasmooth joined the channel
      • It'll give you a quick intro to the language, including interfaces and implemenataions.
      • fibbot
        That's actually where I was testing the code before the Go playground heh
      • I'll take a look at the interface section
      • lluad
        Look at creating a RecordingDevice that isn't a Camera. That'll get you past it.
      • wkmanire
        Ah, I see.
      • fibbot
        Alright I'll give it a shot, thank you for your help lluad :D
      • wkmanire
        A Camera is a RecordingDevice because it implements record() string
      • And the record function is what is called to determine the status...
      • danthemyth has quit
      • moloch joined the channel
      • Out of curiousity, when does Go determine if a struct implements an interface?
      • lluad
        Any struct that implements all the methods the interface has implements that interface.
      • wkmanire
        Is that determined at compile time?
      • lluad
        Actually, any *type* rather than struct. It can be a pointer or an aliased string or int ot ...
      • Yeah, all compile time.
      • sedition
        i guess im dumb. i dont get it. i need to go back and study
      • banisterfiend has quit
      • _ADN_ has quit
      • wkmanire
        sedition: You're probably not dumb. :)
      • banisterfiend joined the channel
      • sedition
        programming is def not my strong suit
      • notdaniel joined the channel
      • Tv`
        sedition: CTF is not really typical programming, though
      • and this is a really artificial CTF challenge
      • and not really CTF, either ;)
      • CTF = "here's a server, please pwn it and remain in power"
      • fibbot
        Right, it's just a similar process to a lot of the CTF challenges for learning - I wasn't sure what to call it exactly
      • Tv`
        stepping stone to l33tness?
      • wkmanire
        How can l33tness still be a thing 20 years later?
      • sedition
        security has gotten bigger
      • unfortunately there's a lot of doofuses
      • but we're still kickin
      • banisterfiend has quit
      • wkmanire
        sedition: That sample code that fibbot posted is nonsensical
      • Is it normal to have "if err != nil" scattered all throughout a code base with Go? I feel like sometimes functions return errors where there is nothing productive I can do with them and also I don't want to exit the program. I just log the error and continue on my way.
      • banisterfiend joined the channel
      • sedition
        yep. it's normal. some people write goofy little helper functions to check errors for them but i prefer to do it the long way
      • that way other engineers can understand my work
      • nemothekid has quit
      • g00s joined the channel
      • wkmanire has left the channel
      • lluad
        wkmanire: Pretty usual. Generally if you get an unexpected error you'll return it to whoever called you.
      • sedition
        i personally dont mind it
      • i have full control of my errors
      • lluad
        At some point up the call stack you get to somewhere where you actually handle it - which can be logging it and continuing, showing it to the user, exiting ...
      • sedition
        'Errors are values'
      • segy joined the channel
      • Hyp3ri0n joined the channel
      • stargater has quit
      • moloch has quit
      • arch3y
        sedition: are you gonna checkout blackhat go
      • Tv`
        he left, guys..
      • arch3y
        ah righto
      • sedition
        arch3y: yeah
      • i have low expectations tbh
      • moloch joined the channel
      • there might be a few fun exercises
      • arch3y
        yeah I have not looked at it yet, but I did see it at defcon
      • was curious
      • sedition
        but i expect its going to be the same 'implement a port scanner that isnt even close to as good as nmap'
      • arch3y: were they pimping it at defcon?
      • arch3y
        yeah it was at the nostarch press booth
      • sedition
        oh col
      • im literally carrying my PoC||GTFO bible rn
      • lol
      • arch3y
        yeah me too
      • well in my bag