Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
if and switch are generally represented differently in the compiler's IR, and it's just that optimizers are usually smart enough to turn if/else chains into switches.

Adbot
ADBOT LOVES YOU

QuarkJets
Sep 8, 2008

JawnV6 posted:

Okay. You still can't discern a difference between "attacker who can clone a disk and execute find -name "*.c"" and "attacker who can clone a disk, extract SSH keys, determine the server through meticulous examination of command history, somehow gin up what they were doing on the long-closed remote session once they have access, all under a time limit before IT slams the door shut". Second group of folks seems a lot more clever and capable by the minute.

For sure.

No, I'm on the side that thinks that if you're looking to steal source code then it's better to clone an unlocked disk than to try and investigate a remote server through SSH. I just think that it's funny that you recognized that you could use the find command to identify source code but apparently you think that typing "!ssh" on an open terminal is some next level hacker poo poo

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I discovered something fun today and wrote a blog post about it.

http://blog.mecheye.net/2017/10/urg/

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

Suspicious Dish posted:

I discovered something fun today and wrote a blog post about it.

http://blog.mecheye.net/2017/10/urg/
Your before-last paragraph seems to have a missing sentence:

quote:

How did everyone get confused and start misunderstanding the TCP urgent mechanism? Even today, despite Linux allowing you to My best guess is that the broken behavior is actually more useful than the one suggested by TCP.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Suspicious Dish posted:

I discovered something fun today and wrote a blog post about it.

http://blog.mecheye.net/2017/10/urg/

Huh, I didn't think anything used URG but here comes Telnet.

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer
This is where someone should step in with a Fermi estimate of how many nearly meaningless bytes URG bytes have been sent over the wire since TCP was invented.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

SupSuper posted:

Your before-last paragraph seems to have a missing sentence:

i'm a good proofreader. that was supposed to talk about SO_OOBINLINE but then i realized that it's actually useless and doesn't let you check whether you're in urgent mode. deleted.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Munkeymon posted:

Huh, I didn't think anything used URG but here comes Telnet.

also, if you search for URG online it's supposedly used by FTP to high-priority commands during a file transfer, but I can't find any evidence of this in either FTP client source code or any of the many FTP RFCs (mainly 959, the revised FTP protocol spec, and 765, the first RFC which ported FTP from NCP to TCP)

JawnV6
Jul 4, 2004

So hot ...

QuarkJets posted:

I just think that it's funny that you recognized that you could use the find command to identify source code but apparently you think that typing "!ssh" on an open terminal is some next level hacker poo poo

One being under a time limit is more pertinent than the relative "skills" of the attacker and your myopic focus on how clever this fellow is or is not keeps exposing how poo poo your underlying threat model of "exactly one server to ssh into" is.

Hargrimm
Sep 22, 2011

W A R R E N

Suspicious Dish posted:

i'm a good proofreader. that was supposed to talk about SO_OOBINLINE but then i realized that it's actually useless and doesn't let you check whether you're in urgent mode. deleted.

Also, "urgency is an attribute of the TCP socket itself, not of a piece of data of data within that stream". Interesting read though, thanks!

QuarkJets
Sep 8, 2008

JawnV6 posted:

One being under a time limit is more pertinent than the relative "skills" of the attacker and your myopic focus on how clever this fellow is or is not keeps exposing how poo poo your underlying threat model of "exactly one server to ssh into" is.

Again, I know reading comprehension is hard for you, but we are on the same side of the argument

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

The tone this discussion took may not be a coding horror, but it's definitely a horror.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Thermopyle posted:

The tone this discussion took may not be a coding horror, but it's definitely a horror.

50+% of coding is clear communication, so I'd say this qualifies.

Steve French
Sep 8, 2003

QuarkJets posted:

No, I'm on the side that thinks that if you're looking to steal source code then it's better to clone an unlocked disk than to try and investigate a remote server through SSH. I just think that it's funny that you recognized that you could use the find command to identify source code but apparently you think that typing "!ssh" on an open terminal is some next level hacker poo poo

So you're also presuming that the key used to SSH either has no password, or has been added to an ssh agent in the currently active session. Also that the server is even accessible on a public network, or that there is an active VPN connection or one available without password authentication

AotC
May 16, 2010

Pollyanna posted:

Remind me again why we don't like switch cases? I've always been told to avoid them, but I never quite understood why. If you're working in a functional language then you kinda need to use pattern matching anyway, but in other languages, you don't have much of a choice.

It's not about disliking them. Switch cases have their uses and it usually comes down to readability. That being said there's a ton of esoteric bullshit that can go into it depending on which language, compiler, optimizations, etc. A buddy of mine once did an in-depth study on which was faster in .net: dictionary look up, switch statement, if/else chain. With different methods of generating them: in source, at runtime via expression trees, etc. They all had fairly different results in terms of performance and that's just a single language.

tl;dr: Unless you need a specific level of performance out of it just do what is easier to read.

QuarkJets
Sep 8, 2008

Steve French posted:

So you're also presuming that the key used to SSH either has no password, or has been added to an ssh agent in the currently active session. Also that the server is even accessible on a public network, or that there is an active VPN connection or one available without password authentication

Nope, I'm not presuming anything like that. Here let me quote just the most relevant part:

QuarkJets posted:

No, I'm on the side that thinks that if you're looking to steal source code then it's better to clone an unlocked disk

Odette
Mar 19, 2011

Who the gently caress would want to steal someone's lovely code? It's not like you're the loving NSA.

Loezi
Dec 18, 2012

Never buy the cheap stuff
Is it cheating to post this?

https://github.com/raxod502/TerrariaClone

ETA:

quote:

The TerrariaClone.init() method, which is over 1,300 lines long, actually grew so large that the Java compiler started running out of memory trying to compile it! The solution? Copy half of the init() code into a new method, called codeTooLarge(), and call that from init().

:master:

Loezi fucked around with this message at 07:56 on Oct 13, 2017

AotC
May 16, 2010

quote:

The control flow is so labyrinthine that some of the code is actually indented by 23 tabs. Forget the 80-column rule -- these lines don't even start until column 92! Even if we discard the inline data tables, then the longest line in the codebase is still a whopping 387 characters long (you'll have to scroll to the right to read it)

:vince:


At least this guy is upfront about how awful it is.

AotC fucked around with this message at 08:13 on Oct 13, 2017

Xarn
Jun 26, 2015

Odette posted:

Who the gently caress would want to steal someone's lovely code? It's not like you're the loving NSA.

Lol if your code is so worthless nobody would want to steal it.*



* Note that there is a difference between would want to and actually bothers to follow through

canis minor
May 4, 2011

I just went through process of retrieving my bank information (yay for your bank not having correct infromation it failed to communicate it needs):
- all the SMS messages for verification purposes display the sender as "probably the name of the dev that integrated it" rather than "name of the bank"
- if your account is blocked, such information is not displayed anywhere
- trying to send a message about issue number one gave me a hilarious "You can't use #, $, ', " in the content of the message", which is rather worrying (this is using the Account interface they're providing)

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
JavaScript code:
if (!itemThatMustHaveValue || !itemThatMustHaveValue.MemberThatMustHaveValue)
	return;
I just got a code review comment on this that it had to be an && and that if only one of them was null it would fail later in the function. Like I understand where the confusion comes from, and when I was first learning I made that sort of mistake all the time, but this was from someone who is a professional developer in a code review comment. I have just been told to change my code to make it not work as intended.

:psyduck:

Joda fucked around with this message at 14:51 on Oct 13, 2017

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
do you imagine he just didn't spot the ! and hastily left a comment because i do that all the time

john donne
Apr 10, 2016

All suitors of all sorts themselves enthral;

So on his back lies this whale wantoning,

And in his gulf-like throat, sucks everything

That passeth near.
Give 'em the ol' freshman logic 101 truth table for maximum shame.

FlapYoJacks
Feb 12, 2009

john donne posted:

Give 'em the ol' freshman logic 101 truth table for maximum shame.

Make sure to add a gigantic red arrow for ludicrous levels of shame.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

Suspicious Dish posted:

do you imagine he just didn't spot the ! and hastily left a comment because i do that all the time

Oh yeah, that's definitely possible. That's pretty much how we do it everywhere else, though, since massively nested if-statements are awful.

iospace
Jan 19, 2038


Loezi posted:

Is it cheating to post this?

https://github.com/raxod502/TerrariaClone

ETA:


:master:

I've seen a function of that length. It had 0 useful comments, combined tabs and spaces, and determined if someone's health insurance paid out.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Joda posted:

Oh yeah, that's definitely possible. That's pretty much how we do it everywhere else, though, since massively nested if-statements are awful.

it's likely he missed the the "!" because it's right next to an "i" and your brain blends "!i" together just like it blended the two "the"s at the start of this post

boo_radley
Dec 30, 2005

Politeness costs nothing

Suspicious Dish posted:

it's likely he missed the the "!" because it's right next to an "i" and your brain blends "!i" together just like it blended the two "the"s at the start of this post

You son of a bitch

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


iospace posted:

I've seen a function of that length. It had 0 useful comments, combined tabs and spaces, and determined if someone's health insurance paid out.

:lol:

This is like the "for sale: baby shoes, never worn" of this thread.

Jeb Bush 2012
Apr 4, 2007

A mathematician, like a painter or poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.

iospace posted:

I've seen a function of that length. It had 0 useful comments, combined tabs and spaces, and determined if someone's health insurance paid out.

America.java

5TonsOfFlax
Aug 31, 2001

iospace posted:

I've seen a function of that length. It had 0 useful comments, combined tabs and spaces, and determined if someone's health insurance paid out.

Couldn't that just be reduced to
code:
return false;

lifg
Dec 4, 2000
<this tag left blank>
Muldoon

iospace posted:

I've seen a function of that length. It had 0 useful comments, combined tabs and spaces, and determined if someone's health insurance paid out.

Optum?

iospace
Jan 19, 2038


lifg posted:

Optum?

Nah.

Ranzear
Jul 25, 2013

5TonsOfFlax posted:

Couldn't that just be reduced to
code:
return false;

Nah, you have to at least look up their tax bracket to determine if they're a freeloader first, then deny them.

(Spoiler: Only freeloaders need health insurance)

Ranzear fucked around with this message at 18:50 on Oct 13, 2017

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

iospace posted:

I've seen a function of that length. It had 0 useful comments, combined tabs and spaces, and determined if someone's health insurance paid out.

Please tell me it had no tests either.

iospace
Jan 19, 2038


NihilCredo posted:

Please tell me it had no tests either.

Oh we could test it all right, but the thing was we had no clue how it worked.

Nor did the people who wrote it by that point.

(full disclaimer, this was C++, not Java)

Ranzear
Jul 25, 2013

Speaking of early projects, I realized I found and hosted DerpShine again. It's a clone of that flash game BoomShine of course, but without the catchy piano roll.

http://caliber.online/DerpShine.htm

This was the earliest era of Chrome having hardware accelerated canvas, like 22 or 23, so doing 60fps was a big deal to me.

It's a questionable implementation, but apparently I'm reducing Draw rate when Sim rate falls off. I totally cribbed this from my SuperTanks wankery, but it works really well with this (hopefully) fixed timestep game. My earliest notions of disconnecting draw rate from simulation rate.

Code here:
http://caliber.online/DerpShine.js

Topically, almost all of the logic appears to be switch case on enums.

Ranzear fucked around with this message at 18:55 on Oct 13, 2017

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Joda posted:

JavaScript code:
if (!itemThatMustHaveValue || !itemThatMustHaveValue.MemberThatMustHaveValue)
	return;
I just got a code review comment on this that it had to be an && and that if only one of them was null it would fail later in the function. Like I understand where the confusion comes from, and when I was first learning I made that sort of mistake all the time, but this was from someone who is a professional developer in a code review comment. I have just been told to change my code to make it not work as intended.

:psyduck:

maybe they were trying to get you to make the code clearer by applying de morgan's laws

Adbot
ADBOT LOVES YOU

LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer

Hammerite posted:

maybe they were trying to get you to make the code clearer by applying de morgan's laws

I actually generally prefer ¬P ∨ ¬Q to ¬(P ∧ Q), because my desire to have as few parentheses as possible trumps my desire to have as few negations as possible. In the first example it's easier to see at a glance that P = F implies that the whole expression is true, which is important sometimes. The second example technically also has one more token in it than the first one, so while you and others may find it clearer, it's hard to argue that it's simpler. But I view all this as mostly a matter of personal taste, so I probably wouldn't tell anyone to change it one way or the other in a code review.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply