sage: H = SymmetricGroup(4)

Then G will be represented as permutations of 1, 2, ..., 8. H.direct_product(H) is a tuple, the first entry of which is the actual direct product; the other entries give inclusions of the two factors into the product and projections, likewise.