Ethernaut lvl 22,23

Fun fact the dex has a function called

  function approve(address spender, uint amount) public {
    SwappableTokenTwo(token1).approve(spender, amount);
    SwappableTokenTwo(token2).approve(spender, amount);

now you can just call this function, as spender your wallet and after that you call the transferFrom function.
When you use the approve function of the dex, the dex uses the approve function of the tokens wich mean that the dex is the owner and "spender" is the spender. Because spender is you this means you can use TransferFrom to get the tokens.