I pulled out an old toilet and there wasn't a flange in the floor to use when installing the replacement. It looks like the bolts were drilled straight into the ground, although one of them I had to pull out to remove the toilet. I'm not sure what kind of pipe it is; it looks like concrete on the inside, but looking up at the pipe from the basement it's definitely some sort of metal; not sure if it's cast iron or if it's painted black.
Is there any way to add a flange to this without having to drill new holes through the floor?
Here are some photos of what I'm seeing. The first photo is of where the old toilet was removed. The second photo is the pipe underneath, in the basement. The pipe looks kinda grody, but it's been there for 90+ years.