News for hackers. Stuff that matters.
Re:Nazar: Analyzing malware that was uncovered in leaked NSA... by oefrha on Wednesday May 06, 2020 @01:39AM (#23088176)
> Territorial Dispute

  def path_normalize(path):
      try:
          path = re.sub('%(.+)%', (lambda m: ('%{0}%'.format(m.group(1)) if (m.group(1) not in datastore.ENV_VARS) else datastore.ENV_VARS[m.group(1)])), path)
      except:
          tedilog.error(...)
      return path
What a terrible way to write

  return re.sub(r'%(.+)%', lambda m: datastore.ENV_VARS.get(m.group(1), m.group(0)), path)
Re:Nazar: Analyzing malware that was uncovered in leaked NSA... by itsspring on Wednesday May 06, 2020 @07:30AM (#23089797)
Does yours catch the exception?
Re:Nazar: Analyzing malware that was uncovered in leaked NSA... by oefrha on Wednesday May 06, 2020 @07:49AM (#23089912)
Apparently I didn’t include the parts that don’t need to be changed. (Actually, with the correct input type, this piece of code shouldn’t raise any exception period other than BaseExcept like KeyboardInterrupt, which usually shouldn’t be caught like this either. So I would omit the try...except myself.)
Re:Nazar: Analyzing malware that was uncovered in leaked NSA... by mimimi31 on Wednesday May 06, 2020 @07:50AM (#23089922)
Also:

  if result:
    return True
  return False
Re:Nazar: Analyzing malware that was uncovered in leaked NSA... by partisan on Wednesday May 06, 2020 @08:15AM (#23090096)
I’m not a python programmer, but isn’t this a good way of turning truthy or falsey answers into actual Boolean values?
Re:Nazar: Analyzing malware that was uncovered in leaked NSA... by oefrha on Wednesday May 06, 2020 @08:23AM (#23090145)
If you want to do that just use bool().